Created
September 9, 2012 20:18
-
-
Save dyoder/3686998 to your computer and use it in GitHub Desktop.
Class and instance methods in Ruby
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 FooMethods | |
def bar | |
"bar" | |
end | |
end | |
class Foo | |
extend FooMethods | |
include FooMethods | |
end | |
puts Foo.bar | |
puts Foo.new.bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment