Created
December 17, 2008 11:43
-
-
Save samaaron/37032 to your computer and use it in GitHub Desktop.
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
module A | |
def hi(*list) | |
list.each do |l| | |
class_eval do | |
define_method l do | |
puts l | |
end | |
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