Class: Ruboty::Brains::Redis
- Inherits:
-
Base
- Object
- Base
- Ruboty::Brains::Redis
- Defined in:
- lib/ruboty/brains/redis.rb
Constant Summary collapse
- KEY =
"brain"
Instance Attribute Summary collapse
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize ⇒ Redis
constructor
A new instance of Redis.
-
#validate! ⇒ Object
Override.
Constructor Details
#initialize ⇒ Redis
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
#thread ⇒ Object (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
#data ⇒ Object
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 |