Class: AASM::SupportingClasses::Integers
- Inherits:
-
Object
- Object
- AASM::SupportingClasses::Integers
- Defined in:
- lib/integers.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #add_integer(state) ⇒ Object
- #by_integer(i) ⇒ Object
- #by_state(name) ⇒ Object
-
#initialize ⇒ Integers
constructor
A new instance of Integers.
- #setted? ⇒ Boolean
Constructor Details
#initialize ⇒ Integers
Returns a new instance of Integers.
5 6 7 |
# File 'lib/integers.rb', line 5 def initialize self.hash = {} end |
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash.
4 5 6 |
# File 'lib/integers.rb', line 4 def hash @hash end |
Instance Method Details
#[](name) ⇒ Object
13 14 15 |
# File 'lib/integers.rb', line 13 def [](name) by_state(name) end |
#add_integer(state) ⇒ Object
9 10 11 |
# File 'lib/integers.rb', line 9 def add_integer(state) self.hash[state.[:integer]] = state.name end |
#by_integer(i) ⇒ Object
21 22 23 |
# File 'lib/integers.rb', line 21 def by_integer(i) self.hash[i] end |
#by_state(name) ⇒ Object
17 18 19 |
# File 'lib/integers.rb', line 17 def by_state(name) self.hash.invert[name] end |
#setted? ⇒ Boolean
25 26 27 |
# File 'lib/integers.rb', line 25 def setted? !self.hash.nil? end |