Skip to content

Ever-tolerance to options

Compare
Choose a tag to compare
@nepalez nepalez released this 06 Nov 10:49

Default initializer is provided by extending the Mixin (in earlier version it was built only by param or option invocations.

From the very beginning the method accepts any option (ignores unknown ones)

class MyClass
  extend Dry::Initializer::Mixin
end

instance = MyClass.new foo: :bar # undefined options are accepted
instance.respond_to? :foo        # ...but ignored

This was made to provide more consistent behavior (in v0.8.0 tolerance to unknown options occurred all of a sudden after the first option was defined)