-
-
Save edisonywh/9a190a7c1874cd0c9c3806b31a0cb7a4 to your computer and use it in GitHub Desktop.
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
class Foo | |
def self.class_method | |
puts "This is a class method of #{self}" | |
end | |
def an_instance_method | |
puts "This is an instance method of #{self}" | |
end | |
end | |
Foo.class_method #=> "This is a class method of Foo" | |
Foo.new.class_method #=> undefined method `class_method' for #<Foo:0x007f83960d2228> (NoMethodError) | |
Foo.an_instance_method #=> undefined method `an_instance_method' for Foo:Class (NoMethodError) | |
Foo.new.an_instance_method #=> This is an instance method of #<Foo:0x007f80aa92d150> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment