Created
November 9, 2013 20:32
-
-
Save ravinggenius/7389655 to your computer and use it in GitHub Desktop.
valid metaprogramming?
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
class HTTP | |
def request(method, options) | |
# stuff... | |
end | |
[ | |
:get, | |
:head, | |
:put, | |
:post | |
].each do |method| | |
define_method method do |options| | |
request method, options | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here are my thoughts. Obviously as a sketch I may be missing something you have in mind, but let me know.