Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a8397f538938^
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a97f1979c3e3
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on May 23, 2015

  1. implement specs for comparing a method defined via define_method and …

    …a method defined via def
    tak1n committed May 23, 2015
    Copy the full SHA
    a8397f5 View commit details

Commits on May 24, 2015

  1. Fix Method#==

    A Method defined via def has an executable attribute of class
    Rubinius::CompiledCode. On the other site a method defined via
    define_method has an executable attribute of class
    Rubinius::BlockEnvironment::AsMethod.
    
    Comparing method equality includes the comparison of executable
    equality.
    
    For comparing an executable of type Rubinius::BlockEnvironment::AsMethod
    against an executable of Rubinius::CompiledCode results in an error because it tries
    to access the block_env attribute on an Rubinius::CompiledCode object,
    which doesn't exist.
    
    This commit adds an early return like in Rubinius::CompiledCode#==
    tak1n committed May 24, 2015
    Copy the full SHA
    a97f197 View commit details
Showing with 11 additions and 0 deletions.
  1. +1 −0 kernel/common/block_environment.rb
  2. +10 −0 spec/ruby/core/method/shared/eql.rb
1 change: 1 addition & 0 deletions kernel/common/block_environment.rb
Original file line number Diff line number Diff line change
@@ -105,6 +105,7 @@ def ==(other)
# when given a Proc.
#
# The methods are equal if the BEs are equal.
return false unless other.kind_of? AsMethod

@block_env == other.block_env
end
10 changes: 10 additions & 0 deletions spec/ruby/core/method/shared/eql.rb
Original file line number Diff line number Diff line change
@@ -54,6 +54,16 @@
@m_foo.send(@method, m2).should be_true
end

it "returns false if comparing a method defined via define_method and def" do
MethodSpecs::Methods.send :define_method, :defined_foo, lambda {}

defn = @m.method(:foo)
defined = @m.method(:defined_foo)

defn.send(@method, defined).should be_false
defined.send(@method, defn).should be_false
end

describe 'missing methods' do
it "returns true for the same method missing" do
miss1 = @m.method(:handled_via_method_missing)