Class: Eco::API::UseCases::UseCaseIO
- Includes:
- Chain
- Defined in:
- lib/eco/api/usecases/use_case_io.rb,
lib/eco/api/usecases/use_case_io/chain.rb
Overview
Same as Eco::API::UseCases::BaseIO but:
- includes
typeof usecase - provides a helper to
chainInputOutput between usecases
InputOutput class for usecases.
Defined Under Namespace
Modules: Chain
Constant Summary
Constants included from BaseCase::Model
Constants included from BaseCase::Type
Instance Attribute Summary collapse
-
#usecase ⇒ Eco::API::UseCases::UseCase
the usecase this InputOuput is linked to.
Attributes inherited from BaseIO
#data, #input, #options, #output, #session
Attributes included from Language::AuxiliarLogger
Instance Method Summary collapse
-
#initialize(usecase:, job: nil, **kargs) ⇒ UseCaseIO
constructor
A new instance of UseCaseIO.
-
#model ⇒ Symbol
The
modelof the UseCase this InputOuput is linked to. - #model=(_value) ⇒ Object
- #new(usecase:, **kargs) ⇒ Eco::API::UseCases::UseCaseIO
-
#params(keyed: false, all: false) ⇒ Object
Same as its superclass but adding
usecaseandjobparameters. -
#type ⇒ Symbol
The
typeof the UseCase this InputOuput is linked to. - #type=(_value) ⇒ Object
Methods included from Chain
Methods inherited from BaseIO
Methods included from BaseIO::Chaining
Methods included from Language::AuxiliarLogger
Methods included from Language::Methods::DslAble
#evaluate, #method_missing, #respond_to_missing?
Methods included from Common::ClassHelpers
#class_resolver, #descendants, #descendants?, #inheritable_attrs, #inheritable_class_vars, #inherited, #instance_variable_name, #new_class, #resolve_class, #to_constant
Constructor Details
#initialize(usecase:, job: nil, **kargs) ⇒ UseCaseIO
Returns a new instance of UseCaseIO.
18 19 20 21 22 |
# File 'lib/eco/api/usecases/use_case_io.rb', line 18 def initialize(usecase:, job: nil, **kargs) self.usecase = usecase @job = job super(**kargs) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Eco::Language::Methods::DslAble
Instance Attribute Details
#usecase ⇒ Eco::API::UseCases::UseCase
the usecase this InputOuput is linked to
9 10 11 |
# File 'lib/eco/api/usecases/use_case_io.rb', line 9 def usecase @usecase end |
Instance Method Details
#model ⇒ Symbol
Returns the model of the UseCase this InputOuput is linked to.
47 48 49 |
# File 'lib/eco/api/usecases/use_case_io.rb', line 47 def model usecase.model end |
#model=(_value) ⇒ Object
55 56 57 |
# File 'lib/eco/api/usecases/use_case_io.rb', line 55 def model=(_value) raise "Can't modify model: depends on the usecase linked to this IO object" end |
#new(usecase:, **kargs) ⇒ Eco::API::UseCases::UseCaseIO
27 28 29 30 31 |
# File 'lib/eco/api/usecases/use_case_io.rb', line 27 def new(usecase:, **kargs) default = { usecase: usecase } default.merge!(job: @job) if @job super(**default.merge(kargs)) end |
#params(keyed: false, all: false) ⇒ Object
Same as its superclass but adding usecase and job parameters
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/eco/api/usecases/use_case_io.rb', line 61 def params(keyed: false, all: false) super(keyed: keyed, all: all).tap do |res| if keyed res.merge!(usecase: usecase) res.merge!(job: @job) if @job else res.push(usecase) res.push(@job) if @job end end end |
#type ⇒ Symbol
Returns the type of the UseCase this InputOuput is linked to.
42 43 44 |
# File 'lib/eco/api/usecases/use_case_io.rb', line 42 def type usecase.type end |
#type=(_value) ⇒ Object
51 52 53 |
# File 'lib/eco/api/usecases/use_case_io.rb', line 51 def type=(_value) raise "Can't modify type: depends on the usecase linked to this IO object" end |