Project

General

Profile

Actions

Bug #12514

closed

Refinements: when including Module as refinement, can't call other module methods

Added by chucke (Tiago Cardoso) almost 8 years ago. Updated almost 8 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:76103]

Description

Very simple script which reproduces the problem:

module Extensions
  def vegetables ; potatoe ; end
  def potatoe ; "potatoe" ; end
end

module Refinary
  refine String do
    # this doesn't work
    include Extensions
    # this would work...
    # def vegetables ; potatoe ; end
    # def potatoe ; "potatoe" ; end
  end
end

using Refinary

puts "tomatoe".vegetables

#=> in `': undefined method `vegetables' for "tomatoe":String 

failing from ruby 2.0 to 2.3

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0