collectiveidea / interactor

Interactor provides a common interface for performing complex user interactions.
MIT License
3.36k stars 212 forks source link

Fix `Interactor::Context#fail!` error on ruby-2.7.0 #179

Closed pmor closed 4 years ago

pmor commented 4 years ago

In ruby-2.7.0, calling Interactor::Context#fail! with non-empty arguments (i.e. an error message) throws NoMethodError: undefined method[]=' for nil:NilClass`

OpenStruct#modifiable seems to have been removed in ruby-2.7.0

doits commented 4 years ago

Not sure why modifiable was used before, but the name was simply changed to modifiable? and old aliases were removed (https://github.com/ruby/ruby/commit/dbcc224f3883c810049ef620fac8a1b59bde2e69#diff-f0ac5119f74bfda273347c9925e910d7).

So to keep it like before simply add a ? to modifiable, but maybe using self is OK, too.

Edit: Seems like modifiable? is private, so self should be used then.

pmor commented 4 years ago

Actually, I just noticed this is a duplicate of #169, so I'll close it.