Class: Inquirex::Actions::Base
- Inherits:
-
Object
- Object
- Inquirex::Actions::Base
- Defined in:
- lib/inquirex/actions/base.rb
Overview
Abstract base for action effects — the executable units inside an
action block. Subclasses implement #call and, when serializable,
#to_h / .from_h following the same round-trip pattern as Rules::Base.
Effects that wrap Ruby procs (Actions::Custom) return false from #serializable? and are stripped from JSON, consistent with how lambdas are handled everywhere else in Inquirex.
Instance Method Summary collapse
-
#call(answers, outbox) ⇒ void
Executes the effect.
-
#serializable? ⇒ Boolean
Whether this effect survives JSON serialization.
- #to_h ⇒ Hash
-
#validate_against(_definition) ⇒ Object
Hook for effects that must be checked against the definition carrying them (e.g. Webhook vs allowed_domains).
Instance Method Details
#call(answers, outbox) ⇒ void
This method returns an undefined value.
Executes the effect. Email-building effects append Mail::Message objects to the outbox; custom effects may do anything server-side.
19 20 21 |
# File 'lib/inquirex/actions/base.rb', line 19 def call(answers, outbox) raise NotImplementedError, "#{self.class}#call must be implemented" end |
#serializable? ⇒ Boolean
Returns whether this effect survives JSON serialization.
24 |
# File 'lib/inquirex/actions/base.rb', line 24 def serializable? = true |
#to_h ⇒ Hash
36 37 38 |
# File 'lib/inquirex/actions/base.rb', line 36 def to_h raise NotImplementedError, "#{self.class}#to_h must be implemented" end |
#validate_against(_definition) ⇒ Object
Hook for effects that must be checked against the definition carrying them (e.g. Webhook vs allowed_domains). Runs inside Definition#validate!, which both DSL-built and JSON-rehydrated definitions pass through — so violations fail at load time.
33 |
# File 'lib/inquirex/actions/base.rb', line 33 def validate_against(_definition); end |