Class: GraphiteMetric::Plaintext

Inherits:
Struct
  • Object
show all
Extended by:
Util
Defined in:
lib/graphite-metric/plaintext.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util

from_array, from_hash

Constructor Details

#initialize(*args) ⇒ Plaintext

Returns a new instance of Plaintext.



7
8
9
10
# File 'lib/graphite-metric/plaintext.rb', line 7

def initialize(*args)
  super
  self[:timestamp] ||= Time.now.utc.to_i
end

Instance Attribute Details

#keyObject

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



4
5
6
# File 'lib/graphite-metric/plaintext.rb', line 4

def key
  @key
end

#timestampObject

Returns the value of attribute timestamp

Returns:

  • (Object)

    the current value of timestamp



4
5
6
# File 'lib/graphite-metric/plaintext.rb', line 4

def timestamp
  @timestamp
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



4
5
6
# File 'lib/graphite-metric/plaintext.rb', line 4

def value
  @value
end

Instance Method Details

#to_sObject



12
13
14
# File 'lib/graphite-metric/plaintext.rb', line 12

def to_s
  [key, value, timestamp].join(" ")
end