Class: Watsbot::State

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/watsbot/state.rb

Instance Method Summary collapse

Constructor Details

#initializeState

Returns a new instance of State.



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

def initialize
  @redis = Redis.new(:url => Watsbot.configuration.redis_url)
end

Instance Method Details

#delete(key) ⇒ Object



24
25
26
# File 'lib/watsbot/state.rb', line 24

def delete(key)
  @redis.del(key)
end

#exists?(key) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/watsbot/state.rb', line 20

def exists?(key)
  @redis.exists(key)
end

#fetch(key) ⇒ Object



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

def fetch(key)
  @redis.get(key)
end

#store(key, value) ⇒ Object



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

def store(key, value)
  @redis.set(key, value)
end