Class: Transflow::FlowDSL
- Inherits:
-
Object
- Object
- Transflow::FlowDSL
- Defined in:
- lib/transflow/flow_dsl.rb
Defined Under Namespace
Modules: Registry
Instance Attribute Summary collapse
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(options, &block) ⇒ FlowDSL
constructor
A new instance of FlowDSL.
- #operations ⇒ Object
- #step(*args, &block) ⇒ Object
Constructor Details
#initialize(options, &block) ⇒ FlowDSL
26 27 28 29 30 31 |
# File 'lib/transflow/flow_dsl.rb', line 26 def initialize(, &block) @options = @container = .fetch(:container) @steps = {} instance_exec(&block) end |
Instance Attribute Details
#container ⇒ Object (readonly)
Returns the value of attribute container.
22 23 24 |
# File 'lib/transflow/flow_dsl.rb', line 22 def container @container end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
20 21 22 |
# File 'lib/transflow/flow_dsl.rb', line 20 def @options end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
24 25 26 |
# File 'lib/transflow/flow_dsl.rb', line 24 def steps @steps end |
Class Method Details
.[](op) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/transflow/flow_dsl.rb', line 12 def self.[](op) if op.respond_to?(:>>) op else Registry[op] end end |
Instance Method Details
#call ⇒ Object
37 38 39 |
# File 'lib/transflow/flow_dsl.rb', line 37 def call Transaction.new(steps, operations.reduce(:>>)) end |
#operations ⇒ Object
41 42 43 |
# File 'lib/transflow/flow_dsl.rb', line 41 def operations steps.values.reverse.map { |op| self.class[op] } end |