-
Notifications
You must be signed in to change notification settings - Fork 217
Open
Labels
Description
I stumbled across this issue during specs where I named a property on the Context object display. The results were surprising and, after some code reading, it turns out it has to do with the way OpenStruct lazy-loads/queries properties.
Sample class
class SampleInteractor
include Interactor
def call
context.display = 'Foobar'
end
endExpected
SampleInteractor.call.display # => 'Foobar'Actual
SampleInteractor.call.display # => #<Interactor::Context display="Foobar">nilAs mentioned this problem is in using OpenStruct where the same behavior can be observed and it's all because there is already Object#display defined on Object.
Maybe something worth adding to the docs as a caveat?
roryokane