lib/eco/api/usecases/base_io.rb in eco-helpers-1.2.2 vs lib/eco/api/usecases/base_io.rb in eco-helpers-1.3.1

- old
+ new

@@ -9,11 +9,11 @@ def input_required?(type) !valid_type?(type) || [:import, :sync].include?(type) end def people_required?(type) - !valid_type?(type) || [:filter, :transform, :sync, :export].include?(type) + !valid_type?(type) || [:filter, :transform, :sync, :error_handler, :export].include?(type) end end attr_reader :input, :people, :session, :options @@ -52,11 +52,19 @@ Eco::API::UseCases::BaseIO.new(**kargs) end # @see Eco::API::UseCases::BaseIO#initialize # @return [Eco::API::UseCases::BaseIO] - def new(type: self.type, input: self.input, people: self.people, session: self.session, options: self.options, validate: true) - self.class.new(type: type, input: input, people: people, session: session, options: options, validate: validate) + def new(**kargs) + default = { + type: self.type, + input: self.input, + people: self.people, + session: self.session, + options: self.options, + validate: true + }.merge(kargs) + self.class.new(**default.merge(kargs)) end # Helper to build a `Hash` of symbol keys or `Array` with params to do callbacks. def params(keyed: false) kargs = {}