lib/harness/measurement.rb in harness-0.1.2 vs lib/harness/measurement.rb in harness-0.2.0
- old
+ new
@@ -8,10 +8,31 @@
end
self.time ||= Time.now
end
+ def time=(value)
+ if value.is_a? String
+ @time = DateTime.parse value
+ elsif value.is_a? Fixnum
+ @time = Time.at value
+ else
+ @time = value
+ end
+ end
+
def log
Harness.log self
+ end
+
+ def attributes
+ {
+ :id => id,
+ :name => name,
+ :source => source,
+ :time => time,
+ :units => units,
+ :value => value
+ }
end
end
end