Exception: Statecraft::GuardFailed
- Defined in:
- lib/statecraft/errors.rb
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#guard ⇒ Object
readonly
Returns the value of attribute guard.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(record:, guard:, from:, to:, event:) ⇒ GuardFailed
constructor
A new instance of GuardFailed.
Constructor Details
#initialize(record:, guard:, from:, to:, event:) ⇒ GuardFailed
Returns a new instance of GuardFailed.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/statecraft/errors.rb', line 11 def initialize(record:, guard:, from:, to:, event:) @record = record @guard = guard @from = from @to = to @event = event via = event ? " (event #{event})" : nil super("guard #{guard.inspect} failed for #{record.class.name}##{record.id} " \ "on #{from} -> #{to}#{via}") end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
9 10 11 |
# File 'lib/statecraft/errors.rb', line 9 def event @event end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
9 10 11 |
# File 'lib/statecraft/errors.rb', line 9 def from @from end |
#guard ⇒ Object (readonly)
Returns the value of attribute guard.
9 10 11 |
# File 'lib/statecraft/errors.rb', line 9 def guard @guard end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
9 10 11 |
# File 'lib/statecraft/errors.rb', line 9 def record @record end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
9 10 11 |
# File 'lib/statecraft/errors.rb', line 9 def to @to end |