Skip to content

Instantly share code, notes, and snippets.

@kavinderd
Created October 23, 2014 03:50
Show Gist options
  • Save kavinderd/d7d6e6694897200735b0 to your computer and use it in GitHub Desktop.
Save kavinderd/d7d6e6694897200735b0 to your computer and use it in GitHub Desktop.
Refinement Gotchas From Metaprogramming Ruby Book
#
class MyClass
def my_method
"original my_method"
end
def another_method
my_method
end
end
module MyClassRefinement
refine MyClass do
def my_method
"refined my_method"
end
end
end
using MyClassRefinement
puts MyClass.new.my_method #=> "refined my_method"
puts MyClass.new.another_method #=> "original my_method"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment