Last active
December 18, 2015 09:19
-
-
Save ilude/5760678 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
| class Foo | |
| def foo_getter | |
| return self | |
| end | |
| def self.class_getter | |
| return self | |
| end | |
| end | |
| foo = Foo.new | |
| bar = foo.foo_getter | |
| are_they_equal = foo.eql?(bar) | |
| puts "Does foo == bar? #{are_they_equal}" | |
| puts "Foo's ID = #{foo.__id__}" | |
| puts "Bar's ID = #{bar.__id__}" | |
| klass = Foo.class_getter | |
| puts "Does instance foo == klass: #{foo.eql? klass}" | |
| puts "Does class Foo == klass: #{Foo.eql? klass}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment