Created
April 27, 2017 15:15
-
-
Save dholdren/58250ceb791f04b3230c9d79da430b6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#I want to call @request.method(:remote_ip) to find out where it's defined using Object#method method. | |
#But that's been overriden so that you can find out which HTTP verb was used (GET/POST/etc) | |
module ObjectMethod | |
def object_method(name) | |
Object.instance_method(:method).bind(self).call(name) | |
end | |
end | |
Object.include(ObjectMethod) | |
#request.method(:remote_ip) | |
#=> | |
#meth = request.object_method(:remote_ip) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment