Module: Tremolo

Defined in:
lib/tremolo.rb,
lib/tremolo/sender.rb,
lib/tremolo/series.rb,
lib/tremolo/tracker.rb,
lib/tremolo/version.rb,
lib/tremolo/data_point.rb,
lib/tremolo/noop_tracker.rb

Defined Under Namespace

Classes: DataPoint, NoopTracker, Sender, Series, Tracker

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.fetch(as, default = NoopTracker.new(nil, nil)) ⇒ Object



26
27
28
# File 'lib/tremolo.rb', line 26

def fetch(as, default = NoopTracker.new(nil, nil))
  Celluloid::Actor[as.to_sym] || default
end

.supervised_tracker(as, host, port, options = {}) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/tremolo.rb', line 18

def supervised_tracker(as, host, port, options={})
  unless host.nil? || port.nil?
    Celluloid.supervise type: Tracker, as: as.to_sym, args: [host, port, options]
  end

  fetch(as, NoopTracker.new(host, port, options))
end

.tracker(host, port, options = {}) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/tremolo.rb', line 10

def tracker(host, port, options={})
  if host.nil? || port.nil?
    NoopTracker.new(host, port, options)
  else
    Tracker.new(host, port, options)
  end
end