Module: Eco::API::UseCases::BaseIO::Chaining
- Included in:
- Eco::API::UseCases::BaseIO
- Defined in:
- lib/eco/api/usecases/base_io/chaining.rb
Instance Method Summary collapse
-
#chained(as: type) ⇒ Eco::API::UseCases::BaseIO
Does the switch from output to result in a new IO object.
-
#process_case(case_name, case_type, **params) ⇒ Eco::API::UseCases::BaseIO
Shortcut to run a usecase passing this
ioas parameter.
Instance Method Details
#chained(as: type) ⇒ Eco::API::UseCases::BaseIO
Note:
if there isn't output it doesn't do the switch,
provided that it preserves the target parameter
(otherise it would blank it)
Does the switch from output to result in a new IO object.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/eco/api/usecases/base_io/chaining.rb', line 22 def chained(as: type) # rubocop:disable Naming/MethodParameterName base.tap do |io_base| next unless io_base.output case as when :import io_base.output_be_input! when :filter io_base.output_be_data! # when :transform, :sync, :export, :error_handler, :other end end end |
#process_case(case_name, case_type, **params) ⇒ Eco::API::UseCases::BaseIO
Note:
- It swaps
outputtoinputordatadepending onself.type - does this, before the target
case_namelaunch and **after
Shortcut to run a usecase passing this io as parameter
8 9 10 11 12 13 14 15 |
# File 'lib/eco/api/usecases/base_io/chaining.rb', line 8 def process_case(case_name, case_type, **params) session.process_case( case_name, io: chained, type: case_type, **params ).chained end |