Skip to content

Instantly share code, notes, and snippets.

@havenwood
Last active December 22, 2015 20:39
Show Gist options
  • Save havenwood/6527800 to your computer and use it in GitHub Desktop.
Save havenwood/6527800 to your computer and use it in GitHub Desktop.
Refinements seem to no longer work like they once did.
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