Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Bad idea to monkeypatch `.to_s` -- code for post: http://ruby.zigzo.com/2017/10/21/refinements-fancy-monkey/
irb(main):001:0> 1.class
=> Integer
irb(main):002:0> 1.to_s
=> "1"
irb(main):003:0> class Integer
irb(main):004:1> def to_s
irb(main):005:2> "two"
irb(main):006:2> end
irb(main):007:1> end
=> :to_s
irb(main):008:two> 1.to_s
=> "two"
irb(main):009:two> 3.to_s
=> "two"
# WHAT HAVE I DONE TO MY LIFE?!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment