lib/pulse-meter/visualize/widgets/timeline.rb in pulse-meter-0.2.2 vs lib/pulse-meter/visualize/widgets/timeline.rb in pulse-meter-0.2.3

- old
+ new

@@ -17,11 +17,12 @@ def data(options = {}) real_timespan = options[:timespan] || timespan super().merge({ values_title: values_label, series: series_data(real_timespan), - timespan: timespan + timespan: timespan, + interval: interval }) end protected @@ -67,9 +68,17 @@ end unless intervals.all?{|i| i == intervals.first} interval_notice = sensors.map{|s| "#{s.name}: #{s.interval}"}.join(', ') raise DifferentSensorIntervalsInWidget, "Sensors with different intervals in a single widget: #{interval_notice}" + end + end + + def interval + if sensors.empty? + nil + else + sensors.first.interval end end end