Class: Collectd::Packet::Values

Inherits:
Part
  • Object
show all
Defined in:
lib/collectd/pkt.rb

Defined Under Namespace

Classes: Counter, Gauge

Instance Method Summary collapse

Methods inherited from Part

type, #type

Constructor Details

#initialize(v) ⇒ Values

Returns a new instance of Values.



64
65
66
# File 'lib/collectd/pkt.rb', line 64

def initialize(v)
  @v = v
end

Instance Method Details

#to_sObject



67
68
69
70
71
72
73
74
# File 'lib/collectd/pkt.rb', line 67

def to_s
  types, values = [], []
  @v.each { |v1|
    types << [v1.type].pack("C")
    values << v1.to_s
  }
  super [@v.length].pack("n") + types.join + values.join
end