Class: DataCollector::Output::Generic

Inherits:
Object
  • Object
show all
Defined in:
lib/data_collector/output/generic.rb

Direct Known Subclasses

Rpc

Instance Method Summary collapse

Constructor Details

#initialize(uri, options = {}) ⇒ Generic

Returns a new instance of Generic.



9
10
11
12
13
14
15
16
# File 'lib/data_collector/output/generic.rb', line 9

def initialize(uri, options = {})
  @uri = uri
  @options = options
  @running = false

  @name = options[:name] || "output-#{Time.now.to_i}-#{rand(10000)}"
  create_producer
end

Instance Method Details

#running?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/data_collector/output/generic.rb', line 22

def running?
  @running
end

#send(message) ⇒ Object



18
19
20
# File 'lib/data_collector/output/generic.rb', line 18

def send(message)
  raise DataCollector::Error, 'Please implement a producer'
end

#stopObject



30
31
32
# File 'lib/data_collector/output/generic.rb', line 30

def stop
  @running = false
end

#stopped?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/data_collector/output/generic.rb', line 26

def stopped?
  @running == false
end