Skip to content

Instantly share code, notes, and snippets.

@yob
Created August 6, 2009 04:04
Show Gist options
  • Save yob/163133 to your computer and use it in GitHub Desktop.
Save yob/163133 to your computer and use it in GitHub Desktop.
class Demo
METHODS = ["one","two","three","four"]
class << self
METHODS.each do |name|
define_method("method_#{name}") do |arg|
puts "this method is named method_\"#{name}\" and you gave me the arg \"#{arg}\""
end
end
end
end
Demo.method_one("boo")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment