From the code below, it appears the ||=
operator is being evaluated from outside of the class.
class Foo
attr_reader :bar
def baz
self.
That looks like a bug.
UPDATE: The bug was fixed in trunk, and is slated for back porting to 2.1 and 2.0.
Note that the problem is more general than that, it is broken for all abbreviated assignments, not just conditional abbreviated assignments:
private def foo=(*) end
public def foo; 0 end
self.foo = 42
self.foo += 42
# private method `foo=' called for main:Object (NoMethodError)
private :foo
self.foo += 42
# private method `foo' called for main:Object (NoMethodError)