lib/eco/api/usecases/use_case_io.rb in eco-helpers-1.0.11 vs lib/eco/api/usecases/use_case_io.rb in eco-helpers-1.0.12
- old
+ new
@@ -1,37 +1,49 @@
module Eco
module API
class UseCases
+
+ # InputOutput class for usecases.
+ # @note Same as Eco::API::UseCases::BaseIO but:
+ # - includes `type` of usecase
+ # - provides a helper to `chain` InputOutput between usecases
+ # @attr_reader usecase [Eco::API::UseCases::UseCase] the usecase this InputOuput is linked to
class UseCaseIO < BaseIO
- @types = [:import, :filter, :transform, :sync, :export]
+ @types = BaseIO.types
attr_reader :usecase
+ # @see Eco::API::UseCases::BaseIO#initialize
def initialize(usecase:, **kargs)
self.usecase = usecase
super(**kargs)
end
- # @see Eco::API::UseCases::BaseIO
+ # @see Eco::API::UseCases::BaseIO#new
# @param usecase [Eco::API::UseCases::UseCase] target usecase
# @return [Eco::API::UseCases::UseCaseIO]
def new(usecase:, **kargs)
super(**kargs.merge(usecase: usecase))
end
+
+ # @param value [Eco::API::UseCases::UseCase] the usecase this InputOuput should be linked to
def usecase=(value)
raise "It should be a Eco::API::UseCases::UseCase. Given: #{value}" if !value.is_a?(Eco::API::UseCases::UseCase)
@usecase = value
end
+ # @return [Symbol] the `type` of the UseCase this InputOuput is linked to
def type
@usecase.type
end
def type=(value)
raise "Can't modify type depends on the usecase linked to this IO object"
end
+ # @see Eco::API::UseCases::BaseIO#params
+ # Same as its superclass but adding `usecase` parameter
def params(keyed: false)
super(keyed: keyed).tap do |res|
if keyed
res.merge!(usecase: usecase)
else