Class: Bricolage::RedisDataSource
- Inherits:
-
DataSource
- Object
- DataSource
- Bricolage::RedisDataSource
- Defined in:
- lib/bricolage/redisdatasource.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(host: 'localhost', port: 6380, **options) ⇒ RedisDataSource
constructor
A new instance of RedisDataSource.
- #new_task ⇒ Object
- #open {|client| ... } ⇒ Object
Constructor Details
#initialize(host: 'localhost', port: 6380, **options) ⇒ RedisDataSource
Returns a new instance of RedisDataSource.
11 12 13 14 15 |
# File 'lib/bricolage/redisdatasource.rb', line 11 def initialize(host: 'localhost', port: 6380, **) @host = host @port = port @options = end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
17 18 19 |
# File 'lib/bricolage/redisdatasource.rb', line 17 def host @host end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
19 20 21 |
# File 'lib/bricolage/redisdatasource.rb', line 19 def @options end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
18 19 20 |
# File 'lib/bricolage/redisdatasource.rb', line 18 def port @port end |
Instance Method Details
#new_task ⇒ Object
21 22 23 |
# File 'lib/bricolage/redisdatasource.rb', line 21 def new_task RedisTask.new(self) end |
#open {|client| ... } ⇒ Object
25 26 27 28 |
# File 'lib/bricolage/redisdatasource.rb', line 25 def open client = Redis.new(host: @host, port: @port, **@options) yield client end |