lib/ripar/combinder.rb in ripar-0.0.1 vs lib/ripar/combinder.rb in ripar-0.0.2

- old
+ new

@@ -31,10 +31,16 @@ def method_missing( meth, *args, &blk ) if @obj.respond_to?( meth ) && (@binding.self.methods - ::Object.instance_methods).include?( meth ) begin return @obj.__ambiguous_method__( @binding.self, meth, *args, &blk ) rescue ::NoMethodError => ex - ::Kernel.raise AmbiguousMethod, "method :#{meth} exists on both #{@binding.self.inspect} (outside) and #{@obj.inspect} (inside) #{ex.message}" + unless ::Object::RUBY_VERSION == '2.0.0' + # for some reason, any references to ex.message fail here for 2.0.0 + # so only for other versions just double-check versions that it was in fact caused by __ambiguous_method__ + # otherwise just raise whatever was missing. + ::Kernel.raise unless ex.message =~ /__ambiguous_method__/ + end + ::Kernel.raise AmbiguousMethod, "method :#{meth} exists on both #{@binding.self.inspect} (outside) and #{@obj.inspect} (inside)", ex.backtrace[3..-1] end end if @binding.local_variables.include?( meth ) # This branch is only necessary to do lambda calls with (),