Created
March 26, 2014 07:10
-
-
Save adammcarth/9778133 to your computer and use it in GitHub Desktop.
This file contains 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
module Get | |
def get() | |
# Code not necessary | |
end | |
end | |
class JTask | |
extend Get | |
end | |
JTask.get(blah) | |
#=> {"id" => 1, "name" => "John"} | |
# Currently, to get "name" you have to go: | |
JTask.get(blah)["name"] # yuck | |
#=> "John" | |
# I want to implement: | |
JTask.get(blah).name | |
#=> "John" | |
# Would I do this by using method_missing()? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment