Created
November 8, 2011 23:33
-
-
Save brianstorti/1349707 to your computer and use it in GitHub Desktop.
Defining a class w/o the class keyword
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
#with class | |
class MyClass < Array | |
def my_method | |
"w00t" | |
end | |
end | |
#without class | |
MyClass = Class.new(Array) do | |
def my_method | |
"w00t" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment