Class: AASM::SupportingClasses::State
- Inherits:
-
Object
- Object
- AASM::SupportingClasses::State
- Defined in:
- lib/state.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #==(state) ⇒ Object
- #call_action(action, record) ⇒ Object
- #for_select ⇒ Object
-
#initialize(name, options = {}) ⇒ State
constructor
A new instance of State.
- #method_name ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ State
Returns a new instance of State.
6 7 8 |
# File 'lib/state.rb', line 6 def initialize(name, ={}) @name, = name, end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/state.rb', line 4 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/state.rb', line 4 def end |
Instance Method Details
#==(state) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/state.rb', line 14 def ==(state) if state.is_a? Symbol name == state else name == state.name end end |
#call_action(action, record) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/state.rb', line 22 def call_action(action, record) action = [action] case action when Symbol, String record.send(action) when Proc action.call(record) end end |
#for_select ⇒ Object
32 33 34 |
# File 'lib/state.rb', line 32 def for_select [name.to_s.gsub(/_/, ' ').capitalize, name.to_s] end |
#method_name ⇒ Object
10 11 12 |
# File 'lib/state.rb', line 10 def method_name end |