Created
July 9, 2010 21:44
-
-
Save toothrot/470108 to your computer and use it in GitHub Desktop.
a modular way to smack up eigenclass
This file contains 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 Farts | |
def farts | |
"pfft" | |
end | |
end | |
hey = "yo" | |
hey.farts # NoMethodError: undefined method `farts' for "yo":String | |
class << hey; include Farts; end # => #<Class:#<String:0x1021e9238>> | |
hey.farts #=> "pfft" | |
"barf".farts # NoMethodError: undefined method `farts' for "barf":String |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment