You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Defining a method using a proc that had ruby2_keywords called on it should not capture self. I only found this because I'm working on adding delegate.rb which does this:
In that code, with our implementation, the self object is wrong.
Here is a test case if we ever get around to fixing this:
describe'#ruby2_keywords'doit'does not capture self when used as a method'dox=9klass=Class.newdodefine_method(:plain,->(*){[self,x]})define_method(:wrapped,->(*){[self,x]}.ruby2_keywords)endobj=klass.newobj.wrapped.first.should == objobj.wrapped.last.should == 9obj.plain.should == obj.wrappedendend
...but I have to admit, it feels like a waste to spend too much time on it since this is a remnant of by-gone era in Ruby. Maybe we'll get lucky and this method will get removed in a future Ruby version.
The text was updated successfully, but these errors were encountered:
Defining a method using a proc that had
ruby2_keywords
called on it should not captureself
. I only found this because I'm working on adding delegate.rb which does this:In that code, with our implementation, the
self
object is wrong.Here is a test case if we ever get around to fixing this:
...but I have to admit, it feels like a waste to spend too much time on it since this is a remnant of by-gone era in Ruby. Maybe we'll get lucky and this method will get removed in a future Ruby version.
The text was updated successfully, but these errors were encountered: