[#83107] Alias Enumerable#include? to Enumerable#includes? — Alberto Almagro <albertoalmagro@...>

Hello,

9 messages 2017/10/04

[ruby-core:83607] Refinements in block issue?

From: Brandon Fish <brandon.j.fish@...>
Date: 2017-10-29 21:23:22 UTC
List: ruby-core #83607
Is the following example of `using` within a block a scoping bug? I tried
this on 2.3.4 and 2.4.1.

class Example
  def test
    puts "Example#test"
  end
end

module M1
  refine Example do
    def test
      puts "Example#test in M1"
    end
  end
end

module M2
  refine Example do
    def test
      puts "Example#test in M2"
    end
  end
end

e = Example.new
[M1, M2].each { |r|
  e.test
  using r
  e.test
}


# Prints
Example#test
Example#test in M1
Example#test in M1
Example#test in M2

I would expect this to print:
Example#test
Example#test in M1
Example#test
Example#test in M2

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next