Class: StateMachines::Sequel::FailedTransition
- Inherits:
-
Error
- Object
- Error
- StateMachines::Sequel::FailedTransition
- Defined in:
- lib/state_machines/sequel.rb
Instance Attribute Summary collapse
-
#audit_log ⇒ Object
readonly
Returns the value of attribute audit_log.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
-
#initialize(obj, event) ⇒ FailedTransition
constructor
A new instance of FailedTransition.
Constructor Details
#initialize(obj, event) ⇒ FailedTransition
Returns a new instance of FailedTransition.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/state_machines/sequel.rb', line 12 def initialize(obj, event) @event = event @object = obj msg = "#{obj.class}[#{obj.id}] failed to transition on #{event}" if obj.respond_to?(:audit_logs) && !obj.audit_logs.empty? @audit_log = obj.audit_logs.max_by(&:id) msg += ": #{@audit_log.full_message}" msg = msg.gsub("\n", ", ").strip end super(obj, msg) end |
Instance Attribute Details
#audit_log ⇒ Object (readonly)
Returns the value of attribute audit_log.
10 11 12 |
# File 'lib/state_machines/sequel.rb', line 10 def audit_log @audit_log end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
10 11 12 |
# File 'lib/state_machines/sequel.rb', line 10 def event @event end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
10 11 12 |
# File 'lib/state_machines/sequel.rb', line 10 def object @object end |