Class: Bricolage::RedisDataSource

Inherits:
DataSource
  • Object
show all
Defined in:
lib/bricolage/redisdatasource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, **options)
  @host = host
  @port = port
  @options = options
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



17
18
19
# File 'lib/bricolage/redisdatasource.rb', line 17

def host
  @host
end

#optionsObject (readonly)

Returns the value of attribute options.



19
20
21
# File 'lib/bricolage/redisdatasource.rb', line 19

def options
  @options
end

#portObject (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_taskObject



21
22
23
# File 'lib/bricolage/redisdatasource.rb', line 21

def new_task
  RedisTask.new(self)
end

#open {|client| ... } ⇒ Object

Yields:

  • (client)


25
26
27
28
# File 'lib/bricolage/redisdatasource.rb', line 25

def open
  client = Redis.new(host: @host, port: @port, **@options)
  yield client
end