Class: Ruboty::Brains::Redis

Inherits:
Base
  • Object
show all
Defined in:
lib/ruboty/brains/redis.rb

Constant Summary collapse

KEY =
"brain"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRedis

Returns a new instance of Redis.



16
17
18
19
20
# File 'lib/ruboty/brains/redis.rb', line 16

def initialize
  super
  @thread = Thread.new { sync }
  @thread.abort_on_exception = true
end

Instance Attribute Details

#threadObject (readonly)

Returns the value of attribute thread.



9
10
11
# File 'lib/ruboty/brains/redis.rb', line 9

def thread
  @thread
end

Instance Method Details

#dataObject



22
23
24
# File 'lib/ruboty/brains/redis.rb', line 22

def data
  @data ||= pull || {}
end

#validate!Object

Override.



27
28
29
30
# File 'lib/ruboty/brains/redis.rb', line 27

def validate!
  super
  Ruboty.die("#{self.class.usage}") unless url
end