Class: InfluxRemix::Remix
- Inherits:
-
Object
- Object
- InfluxRemix::Remix
- Defined in:
- lib/influx_remix/remix.rb
Instance Method Summary collapse
- #fields ⇒ Object
-
#initialize(data) ⇒ Remix
constructor
A new instance of Remix.
- #line_protocol ⇒ Object
- #measurement ⇒ Object
- #tags ⇒ Object
- #time ⇒ Object
- #update_time(time) ⇒ Object
Constructor Details
#initialize(data) ⇒ Remix
Returns a new instance of Remix.
3 4 5 |
# File 'lib/influx_remix/remix.rb', line 3 def initialize(data) @data = data end |
Instance Method Details
#fields ⇒ Object
25 26 27 28 29 |
# File 'lib/influx_remix/remix.rb', line 25 def fields elements = @data.split(' ') chunk = elements[1].split(',') transform_data(chunk) end |
#line_protocol ⇒ Object
42 43 44 |
# File 'lib/influx_remix/remix.rb', line 42 def line_protocol @data end |
#measurement ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/influx_remix/remix.rb', line 7 def measurement elements = @data.split(',') if has_measurement? return elements.first else return nil end end |
#tags ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/influx_remix/remix.rb', line 16 def elements = @data.split(' ') chunk = elements.first.split(',') if has_measurement? chunk.shift end transform_data(chunk) end |
#time ⇒ Object
31 32 33 |
# File 'lib/influx_remix/remix.rb', line 31 def time @data.split(' ').last end |
#update_time(time) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/influx_remix/remix.rb', line 35 def update_time(time) info = @data.split(' ') info.pop info.push(time.to_s) @data = info.join(' ') end |