Class: Redcat::Catter
- Inherits:
-
Object
- Object
- Redcat::Catter
- Defined in:
- lib/redcat/catter.rb
Instance Method Summary collapse
- #cat(s) ⇒ Object
-
#initialize(opts = {}) ⇒ Catter
constructor
A new instance of Catter.
- #list ⇒ Object
- #redis ⇒ Object
- #redis_url ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Catter
Returns a new instance of Catter.
3 4 5 6 |
# File 'lib/redcat/catter.rb', line 3 def initialize(opts={}) @redis_list = opts[:redis_list] @redis_url = opts[:redis_url] end |
Instance Method Details
#cat(s) ⇒ Object
8 9 10 |
# File 'lib/redcat/catter.rb', line 8 def cat(s) redis.rpush(list, s) end |
#list ⇒ Object
12 13 14 |
# File 'lib/redcat/catter.rb', line 12 def list @redis_list end |
#redis ⇒ Object
16 17 18 |
# File 'lib/redcat/catter.rb', line 16 def redis @redis ||= Redis.new(url: @redis_url) end |
#redis_url ⇒ Object
20 21 22 |
# File 'lib/redcat/catter.rb', line 20 def redis_url @redis_url end |