module TimeExtensions refine Fixnum do def minutes; self * 60; end end end class MyApp using TimeExtensions def initialize p 2.minutes end end MyApp.new # => 120 p 2.minutes # => NoMethodError
ruby 2.0.0-p0 through
Then, just trying to start example script:
$ ~/.rvm/rubies/ruby-2.0.0-p0/bin/ruby refinements.rb refinements.rb:2: warning: Refinements are experimental, and the behavior may change in future versions of Ruby! refinements.rb:8:in `<class:MyApp>': undefined method `using' for MyApp:Class (NoMethodError) from refinements.rb:7:in `<main>'
Wait a minute, what means
undefined method 'using'?
Then refinement keyword's present but nothing works yet?
Sure thing nobody asked me to say that but I'm seriously pissed off.