Class: Igniter::Extensions::Contracts::Reactive::Builder
- Inherits:
-
Object
- Object
- Igniter::Extensions::Contracts::Reactive::Builder
- Defined in:
- lib/igniter/extensions/contracts/reactive/builder.rb
Instance Attribute Summary collapse
-
#plan ⇒ Object
readonly
Returns the value of attribute plan.
Class Method Summary collapse
Instance Method Summary collapse
- #effect(path, &block) ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
- #on_exit(&block) ⇒ Object
- #on_failure(&block) ⇒ Object
- #on_success(path = nil, &block) ⇒ Object
- #react_to(event_type, path: nil, once_per_dispatch: false, &block) ⇒ Object
Constructor Details
Instance Attribute Details
#plan ⇒ Object (readonly)
Returns the value of attribute plan.
8 9 10 |
# File 'lib/igniter/extensions/contracts/reactive/builder.rb', line 8 def plan @plan end |
Class Method Details
.build(&block) ⇒ Object
34 35 36 37 38 |
# File 'lib/igniter/extensions/contracts/reactive/builder.rb', line 34 def self.build(&block) builder = new builder.instance_eval(&block) if block builder.plan end |
Instance Method Details
#effect(path, &block) ⇒ Object
18 19 20 |
# File 'lib/igniter/extensions/contracts/reactive/builder.rb', line 18 def effect(path, &block) @plan = plan.effect(path, &block) end |
#on_exit(&block) ⇒ Object
30 31 32 |
# File 'lib/igniter/extensions/contracts/reactive/builder.rb', line 30 def on_exit(&block) @plan = plan.on_exit(&block) end |
#on_failure(&block) ⇒ Object
26 27 28 |
# File 'lib/igniter/extensions/contracts/reactive/builder.rb', line 26 def on_failure(&block) @plan = plan.on_failure(&block) end |
#on_success(path = nil, &block) ⇒ Object
22 23 24 |
# File 'lib/igniter/extensions/contracts/reactive/builder.rb', line 22 def on_success(path = nil, &block) @plan = plan.on_success(path, &block) end |
#react_to(event_type, path: nil, once_per_dispatch: false, &block) ⇒ Object
14 15 16 |
# File 'lib/igniter/extensions/contracts/reactive/builder.rb', line 14 def react_to(event_type, path: nil, once_per_dispatch: false, &block) @plan = plan.react_to(event_type, path: path, once_per_dispatch: once_per_dispatch, &block) end |