Actions
Bug #11005
closedwhy block bind can not be in my_method2
Bug #11005: why block bind can not be in my_method2
Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
2.1.2, 2.2.1
Description
class MyClass def my_method1 nice_name = "Lucy" @proc = lambda {|say| "#{say}, #{nice_name}"} nice_name = "Sophy" puts @proc.call 'Hi' # => Hi, Sophy nice_name = "Oleg" puts @proc.call 'Hi' # => Hi, Oleg end def my_method2 nice_name = 'Han' puts @proc.call 'Hey' # => Hey, Oleg **#Expect is "Hey, Han"**** end end obj = MyClass.new obj.my_method1 obj.my_method2
Updated by matz (Yukihiro Matsumoto) over 10 years ago
- Status changed from Open to Rejected
@proc binds the scope of my_method1, not of my_method2.
We are not going to change that.
Matz.
Updated by nobu (Nobuyoshi Nakada) over 10 years ago
- Description updated (diff)
Actions