Exception: Statecraft::MetadataRequired
- Defined in:
- lib/statecraft/errors.rb
Overview
A question (can_fire?, may_?, available_) was asked without metadata
while an input_guard stands on the consulted path — its answer without
the input would be a false "no", so the question refuses loudly instead.
An explicit metadata: {} states "my input is empty" and is legal.
Instance Attribute Summary collapse
-
#guards ⇒ Object
readonly
Returns the value of attribute guards.
-
#question ⇒ Object
readonly
Returns the value of attribute question.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
-
#initialize(record:, question:, guards:) ⇒ MetadataRequired
constructor
A new instance of MetadataRequired.
Constructor Details
#initialize(record:, question:, guards:) ⇒ MetadataRequired
Returns a new instance of MetadataRequired.
150 151 152 153 154 155 156 157 |
# File 'lib/statecraft/errors.rb', line 150 def initialize(record:, question:, guards:) @record = record @question = question @guards = guards super("#{question} on #{record.class.name} consults input guards " \ "#{guards.map(&:inspect).join(", ")} — pass metadata: to answer with input " \ "(an explicit metadata: {} means the input is empty)") end |
Instance Attribute Details
#guards ⇒ Object (readonly)
Returns the value of attribute guards.
148 149 150 |
# File 'lib/statecraft/errors.rb', line 148 def guards @guards end |
#question ⇒ Object (readonly)
Returns the value of attribute question.
148 149 150 |
# File 'lib/statecraft/errors.rb', line 148 def question @question end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
148 149 150 |
# File 'lib/statecraft/errors.rb', line 148 def record @record end |