Guest User

Untitled

a guest
Oct 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. class Foo
  2. end
  3.  
  4. Foo.object_id # => 34581480
  5.  
  6. f = Foo.new # => #<Foo:0x000000041f53c0>
  7.  
  8. f.class.object_id # => 34581480
  9.  
  10. # This just prevents the "const redefined" warning
  11. Object.send(:remove_const, :Foo)
  12.  
  13. # "Reload" class Foo
  14. class Foo
  15. end
  16.  
  17. Foo.object_id # => 34580180
  18. f.class.object_id # => 34581480
  19.  
  20. f.is_a?(Foo) # => false
  21. f.class == Foo # => false
  22. f.class.name == "Foo" # => true
Add Comment
Please, Sign In to add comment