Class: AASM::SupportingClasses::Integers

Inherits:
Object
  • Object
show all
Defined in:
lib/integers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeIntegers

Returns a new instance of Integers.



5
6
7
# File 'lib/integers.rb', line 5

def initialize
  self.hash = {}
end

Instance Attribute Details

#hashObject

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.options[: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

Returns:

  • (Boolean)


25
26
27
# File 'lib/integers.rb', line 25

def setted?
  !self.hash.nil?
end