Skip to content

Instantly share code, notes, and snippets.

@ravinggenius
Created November 9, 2013 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ravinggenius/7389655 to your computer and use it in GitHub Desktop.
Save ravinggenius/7389655 to your computer and use it in GitHub Desktop.
valid metaprogramming?
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
@sgharms
Copy link

sgharms commented Nov 9, 2013

Here are my thoughts. Obviously as a sketch I may be missing something you have in mind, but let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment