lib/dry/initializer/mixin.rb in dry-initializer-0.3.0 vs lib/dry/initializer/mixin.rb in dry-initializer-0.3.1

- old
+ new

@@ -10,35 +10,52 @@ # @option options [Boolean] :reader (true) Whether to define attr_reader # # @return [self] itself # def param(name, **options) - @initializer_builder = initializer_builder - .define(self, name, option: false, **options) - self + @initializer_builder = \ + initializer_builder.define(name, option: false, **options) + initializer_builder.call(self) end # Declares a named argument # # @param (see #param) # @option (see #param) # @return (see #param) # def option(name, **options) - @initializer_builder = initializer_builder - .define(self, name, option: true, **options) - self + @initializer_builder = \ + initializer_builder.define(name, option: true, **options) + initializer_builder.call(self) end # Adds new plugin to the builder # # @param [Dry::Initializer::Plugins::Base] plugin # @return [self] itself # def register_initializer_plugin(plugin) @initializer_builder = initializer_builder.register(plugin) initializer_builder.call(self) - self + end + + # Makes initializer tolerant to unknown options + # + # @return [self] itself + # + def tolerant_to_unknown_options + @initializer_builder = initializer_builder.tolerant_to_unknown_options + initializer_builder.call(self) + end + + # Makes initializer intolerant to unknown options + # + # @return [self] itself + # + def intolerant_to_unknown_options + @initializer_builder = initializer_builder.intolerant_to_unknown_options + initializer_builder.call(self) end private def initializer_builder