105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/drone_collectd/parser_old.rb', line 105
def add_value(type, value)
raise(ArgumentError, "unknown type: #{type}") unless ValuePartData::const_defined?(type.to_s.upcase)
data_type = ValuePartData::const_get(type.to_s.upcase)
v = {:data_type => data_type, :val => value}
part = self.parts.detect{|p| p.part_type == CollectdPacket::VALUES }
if part
part.vals.vals_type << data_type
part.vals.vals << v
else
part = Part.new(:part_type => CollectdPacket::VALUES)
part.vals.vals_type << data_type
puts "V: #{v.inspect}"
part.vals.vals << v
self.parts << part
end
end
|