lib/eco/api/usecases/use_case.rb in eco-helpers-2.6.0 vs lib/eco/api/usecases/use_case.rb in eco-helpers-2.6.1
- old
+ new
@@ -38,10 +38,11 @@
# @param kargs [Hash] hash with symbol keys.
# @option kargs [Eco::API::Common::People::Entries, Eco::API::Organization::People] :input the input data of reference.
# @option kargs [Eco::API::Organization::People] :people object.
# @option kargs [Eco::API:Session] :session
# @option kargs [Hash] :options hash with symbol keys (i.e. behaviour modifiers, cli trackers, filters, etc.)
+ # @return [Eco::API::UseCases::UseCaseIO] an io with the result in output
def launch(io: nil, **kargs)
params = io&.params(keyed: true, all: true) || {}
kargs = params.merge(kargs).merge(usecase: self)
UseCaseIO.new(**kargs).tap do |uio|
@@ -86,15 +87,24 @@
use_case_self = self
callback_self.instance_eval do
@session = sess
@options = opts
- @people = peo if peo
- @input = ent if ent
+ if peo
+ @people = peo
+ self.singleton_class.attr_reader(:people) unless respond_to?(:people)
+ end
+ if ent # entries/input
+ @input = ent
+ self.singleton_class.attr_reader(:input) unless respond_to?(:input)
+ end
+
# `self` is the use case itself (when used the Loader)
next unless self.is_a?(Eco::API::Common::Loaders::CaseBase)
+
@usecase = use_case_self
+ self.singleton_class.attr_reader(:usecase) unless respond_to?(:usecase)
end
true
end
end
end