Skip to content

Instantly share code, notes, and snippets.

@leifg
Last active December 10, 2015 22:59
Show Gist options
  • Save leifg/4506637 to your computer and use it in GitHub Desktop.
Save leifg/4506637 to your computer and use it in GitHub Desktop.
[~]$ ruby refinements.rb
refinements.rb:2: warning: Refinements are experimental, and the behavior may change in future versions of Ruby!
refinements.rb:10:in `<class:MyTestClass>': undefined method `using' for MyTestClass:Class (NoMethodError)
from refinements.rb:9:in `<main>'
module RefinementTest
refine Hash do
def super_duper
"Hello World"
end
end
end
class MyTestClass
using RefinementTest
def initialize
puts {}.super_duper
end
end
MyTestClass.new
@leifg
Copy link
Author

leifg commented Feb 6, 2013

Example for problem with refinements in Ruby 2.0 (see http://www.ruby-forum.com/topic/4409740)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment