Skip to content

Instantly share code, notes, and snippets.

@samaaron
Created December 17, 2008 11:35
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 samaaron/37031 to your computer and use it in GitHub Desktop.
Save samaaron/37031 to your computer and use it in GitHub Desktop.
module A
def hi(*list)
list.each do |l|
define_method l do
puts l
end
end
end
end
class B
extend A
end
B.hi(:sam, :toddy)
B.sam # => fails
B.new.sam # => prints "sam"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment