Class: Transflow::FlowDSL Private

Inherits:
Object
  • Object
show all
Defined in:
lib/transflow/flow_dsl.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, &block) ⇒ FlowDSL

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FlowDSL.



20
21
22
23
24
25
26
# File 'lib/transflow/flow_dsl.rb', line 20

def initialize(options, &block)
  @options = options
  @container = options.fetch(:container)
  @step_map = {}
  @step_options = {}
  instance_exec(&block)
end

Instance Attribute Details

#containerObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
# File 'lib/transflow/flow_dsl.rb', line 11

def container
  @container
end

#optionsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/transflow/flow_dsl.rb', line 8

def options
  @options
end

#step_mapObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
# File 'lib/transflow/flow_dsl.rb', line 14

def step_map
  @step_map
end

#step_optionsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
# File 'lib/transflow/flow_dsl.rb', line 17

def step_options
  @step_options
end

Instance Method Details

#callObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



49
50
51
# File 'lib/transflow/flow_dsl.rb', line 49

def call
  Transaction.new(step_map)
end

#monadic(value) ⇒ Object



39
40
41
# File 'lib/transflow/flow_dsl.rb', line 39

def monadic(value)
  step_options.update(monadic: value)
end

#publish(value) ⇒ Object



44
45
46
# File 'lib/transflow/flow_dsl.rb', line 44

def publish(value)
  step_options.update(publish: value)
end

#step(name, options = {}, &block) ⇒ Object



34
35
36
# File 'lib/transflow/flow_dsl.rb', line 34

def step(name, options = {}, &block)
  StepDSL.new(name, step_options.merge(options), container, step_map, &block).call
end

#steps(*names) ⇒ Object



29
30
31
# File 'lib/transflow/flow_dsl.rb', line 29

def steps(*names)
  names.reverse_each { |name| step(name) }
end