Class: RubyReactor::Dsl::MapBuilder
- Inherits:
-
Object
- Object
- RubyReactor::Dsl::MapBuilder
show all
- Includes:
- TemplateHelpers
- Defined in:
- lib/ruby_reactor/dsl/map_builder.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#Failure, #Success, #element, #input, #result, #value
Constructor Details
#initialize(name, mapped_reactor_class = nil, reactor = nil, &block) ⇒ MapBuilder
Returns a new instance of MapBuilder.
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 10
def initialize(name, mapped_reactor_class = nil, reactor = nil, &block)
@name = name
@mapped_reactor_class = mapped_reactor_class || (block ? Class.new(RubyReactor::Reactor) : nil)
@reactor = reactor
@argument_mappings = {}
@async = false
@strict_ordering = true
@batch_size = nil
@source_enumerable = nil
@collect_block = nil
@fail_fast = true end
|
Instance Attribute Details
#argument_mappings ⇒ Object
Returns the value of attribute argument_mappings.
8
9
10
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 8
def argument_mappings
@argument_mappings
end
|
#mapped_reactor_class ⇒ Object
Returns the value of attribute mapped_reactor_class.
8
9
10
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 8
def mapped_reactor_class
@mapped_reactor_class
end
|
#name ⇒ Object
Returns the value of attribute name.
8
9
10
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 8
def name
@name
end
|
#source_enumerable ⇒ Object
Returns the value of attribute source_enumerable.
8
9
10
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 8
def source_enumerable
@source_enumerable
end
|
Instance Method Details
#argument(mapped_input_name, source) ⇒ Object
23
24
25
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 23
def argument(mapped_input_name, source)
@argument_mappings[mapped_input_name] = source
end
|
#async(async = true, batch_size: nil) ⇒ Object
31
32
33
34
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 31
def async(async = true, batch_size: nil)
@async = async
@batch_size = batch_size if batch_size
end
|
#batch_size(size) ⇒ Object
40
41
42
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 40
def batch_size(size)
@batch_size = size
end
|
#build ⇒ Object
52
53
54
55
56
57
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 52
def build
dependencies =
dependencies << @source_enumerable.step_name if @source_enumerable.is_a?(RubyReactor::Template::Result)
RubyReactor::Dsl::StepConfig.new(build_step_config(dependencies))
end
|
#collect(&block) ⇒ Object
44
45
46
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 44
def collect(&block)
@collect_block = block
end
|
#fail_fast(enabled = true) ⇒ Object
48
49
50
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 48
def fail_fast(enabled = true)
@fail_fast = enabled
end
|
#returns(step_name) ⇒ Object
Also known as:
return
65
66
67
68
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 65
def returns(step_name)
ensure_mapped_reactor_class!
@mapped_reactor_class.returns(step_name)
end
|
#source(enumerable) ⇒ Object
27
28
29
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 27
def source(enumerable)
@source_enumerable = enumerable
end
|
#step(name, &block) ⇒ Object
Delegate step definition methods to the mapped reactor class
60
61
62
63
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 60
def step(name, &block)
ensure_mapped_reactor_class!
@mapped_reactor_class.step(name, &block)
end
|
#strict_ordering(enabled = true) ⇒ Object
36
37
38
|
# File 'lib/ruby_reactor/dsl/map_builder.rb', line 36
def strict_ordering(enabled = true)
@strict_ordering = enabled
end
|