Class: InfluxDB::PointValue

Inherits:
Object
  • Object
show all
Defined in:
lib/influxdb/point_value.rb

Overview

Convert data point to string using Line protocol

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ PointValue

Returns a new instance of PointValue.



6
7
8
9
10
11
# File 'lib/influxdb/point_value.rb', line 6

def initialize(data)
  @series    = data[:series].gsub(/\s/, '\ ').gsub(',','\,')
  @values    = stringify(data[:values])
  @tags      = stringify(data[:tags])
  @timestamp = data[:timestamp]
end

Instance Attribute Details

#seriesObject (readonly)

Returns the value of attribute series.



4
5
6
# File 'lib/influxdb/point_value.rb', line 4

def series
  @series
end

#tagsObject (readonly)

Returns the value of attribute tags.



4
5
6
# File 'lib/influxdb/point_value.rb', line 4

def tags
  @tags
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



4
5
6
# File 'lib/influxdb/point_value.rb', line 4

def timestamp
  @timestamp
end

#valuesObject (readonly)

Returns the value of attribute values.



4
5
6
# File 'lib/influxdb/point_value.rb', line 4

def values
  @values
end

Instance Method Details

#dumpObject



13
14
15
16
17
18
19
# File 'lib/influxdb/point_value.rb', line 13

def dump
  dump = "#{@series}"
  dump << ",#{@tags}" if @tags
  dump << " #{@values}"
  dump << " #{@timestamp}" if @timestamp
  dump
end