Class: WitBot::State

Inherits:
Object
  • Object
show all
Defined in:
lib/wit_bot/models/state.rb

Constant Summary collapse

@@states =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state) ⇒ State

Returns a new instance of State.



8
9
10
# File 'lib/wit_bot/models/state.rb', line 8

def initialize(state)
  @state = state
end

Instance Attribute Details

#stateObject (readonly) Also known as: to_s, as_json

Returns the value of attribute state.



4
5
6
# File 'lib/wit_bot/models/state.rb', line 4

def state
  @state
end

Class Method Details

.allObject



16
17
18
# File 'lib/wit_bot/models/state.rb', line 16

def self.all
  @@states.values
end

.find(state) ⇒ Object



12
13
14
# File 'lib/wit_bot/models/state.rb', line 12

def self.find(state)
  @@states[state] ||= State.new(state)
end