From: Leif Gensert Date: 2013-01-11T08:26:44+09:00 Subject: Refinements. Am I doing Something wrong? Hello everyone, I am currently playing around with Ruby 2.0. I wanted to look into Refinements and here is what I came up with: ==== 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 ==== This is basically how it's described everywhere. However when I run this code, I'll get that error: ==== [~]$ ruby refinements.rb refinements.rb:2: warning: Refinements are experimental, and the behavior may change in future versions of Ruby! refinements.rb:10:in `': undefined method `using' for MyTestClass:Class (NoMethodError) from refinements.rb:9:in `
' ==== It only works when I move the 'using RefinementTest' one level up (in the main namespace). But isn't that the same as monkeypatching the Hash class in the first place? Or am I doing something fundamentally wrong? I used 2.0.0-rc1 -- Posted via http://www.ruby-forum.com/.