Exception: Statecraft::GuardFailed

Inherits:
Error
  • Object
show all
Defined in:
lib/statecraft/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#eventObject (readonly)

Returns the value of attribute event.



9
10
11
# File 'lib/statecraft/errors.rb', line 9

def event
  @event
end

#fromObject (readonly)

Returns the value of attribute from.



9
10
11
# File 'lib/statecraft/errors.rb', line 9

def from
  @from
end

#guardObject (readonly)

Returns the value of attribute guard.



9
10
11
# File 'lib/statecraft/errors.rb', line 9

def guard
  @guard
end

#recordObject (readonly)

Returns the value of attribute record.



9
10
11
# File 'lib/statecraft/errors.rb', line 9

def record
  @record
end

#toObject (readonly)

Returns the value of attribute to.



9
10
11
# File 'lib/statecraft/errors.rb', line 9

def to
  @to
end