Class: Inquirex::Actions::Custom
- Defined in:
- lib/inquirex/actions/custom.rb
Overview
Escape-hatch effect wrapping an arbitrary Ruby block, declared in the
DSL as run { |answers, outbox| ... }. Full language power — build a
Mail::Message by hand with outbox.add_message, call a service, record
metrics — at the cost of serialization: like every lambda in Inquirex,
the block is stripped from JSON and exists only in Ruby-authored
definitions.
Instance Method Summary collapse
-
#call(answers, outbox) ⇒ Object
Invokes the wrapped block with the collected answers and the outbox.
-
#initialize(block) ⇒ Custom
constructor
A new instance of Custom.
- #serializable? ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(block) ⇒ Custom
Returns a new instance of Custom.
13 14 15 16 17 |
# File 'lib/inquirex/actions/custom.rb', line 13 def initialize(block) super() @block = block freeze end |
Instance Method Details
#call(answers, outbox) ⇒ Object
Invokes the wrapped block with the collected answers and the outbox.
24 25 26 |
# File 'lib/inquirex/actions/custom.rb', line 24 def call(answers, outbox) @block.call(answers, outbox) end |
#serializable? ⇒ Boolean
28 |
# File 'lib/inquirex/actions/custom.rb', line 28 def serializable? = false |