Class: Tremolo::Series

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/tremolo/series.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tracker, series_name) ⇒ Series

Returns a new instance of Series.



7
8
9
# File 'lib/tremolo/series.rb', line 7

def initialize(tracker, series_name)
  @tracker, @series_name = tracker, series_name
end

Instance Attribute Details

#series_nameObject (readonly)

Returns the value of attribute series_name.



5
6
7
# File 'lib/tremolo/series.rb', line 5

def series_name
  @series_name
end

#trackerObject (readonly)

Returns the value of attribute tracker.



5
6
7
# File 'lib/tremolo/series.rb', line 5

def tracker
  @tracker
end

Instance Method Details

#decrement(tags = {}) ⇒ Object



15
16
17
# File 'lib/tremolo/series.rb', line 15

def decrement(tags = {})
  write_point({value: -1}, tags)
end

#increment(tags = {}) ⇒ Object



11
12
13
# File 'lib/tremolo/series.rb', line 11

def increment(tags = {})
  write_point({value: 1}, tags)
end

#time(tags = {}, &block) ⇒ Object



23
24
25
# File 'lib/tremolo/series.rb', line 23

def time(tags = {}, &block)
  tracker.time(series_name, tags, &block)
end

#timing(value, tags = {}) ⇒ Object



19
20
21
# File 'lib/tremolo/series.rb', line 19

def timing(value, tags = {})
  write_point({value: value}, tags)
end

#write_point(data, tags = {}) ⇒ Object



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

def write_point(data, tags = {})
  write_points([data], tags)
end

#write_points(data, tags = {}) ⇒ Object



31
32
33
# File 'lib/tremolo/series.rb', line 31

def write_points(data, tags = {})
  tracker.write_points(series_name, data, tags)
end