Last active
December 22, 2015 20:39
-
-
Save havenwood/6527800 to your computer and use it in GitHub Desktop.
Refinements seem to no longer work like they once did.
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
module ReverseInt | |
refine Integer do | |
def reverse | |
to_s.reverse.to_i | |
end | |
end | |
end | |
using ReverseInt | |
## | |
# In Ruby 2.0.0 | |
24.reverse | |
#=> 42 | |
## | |
# In Ruby 2.1.0-dev | |
24.reverse | |
#>> NoMethodError: undefined method `reverse' for 24:Fixnum | |
# I'm curious about the changed behavior in 2.1. Intentional? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment