(2012/11/03 10:42), SASADA Koichi wrote:
> ###
> 
> class C
>   def foo
>     p :C_foo
>   end
> end
> 
> module RefineC
>   refine C do
>     def foo
>       p :RefineC_foo
>       super
>     end
>   end
> end
> 
> class C_User
>   using RefineC
>   def x
>     C.new.foo
>   end
> end
> 
> class C_User2
>   def x
>     self.class.send(:using, RefineC)
>     C.new.foo
>   end
> end
> 
> puts "C.new.foo"
> C.new.foo
> 
> puts "C_User.new.x"
> C_User.new.x
> 
> puts "C_User2.new.x"
> C_User2.new.x
> 
> 
> #=>
> C.new.foo
> :C_foo
> C_User.new.x
> :RefineC_foo
> :C_foo
> C_User2.new.x
> :RefineC_foo
> :C_foo

# is that corner case? :)

class C_User2
  def x
    2.times{
      C.new.foo
      self.class.send(:using, RefineC)
    }
  end
end

-- 
// SASADA Koichi at atdot dot net