lib/dasht/metric.rb in dasht-0.1.4 vs lib/dasht/metric.rb in dasht-0.1.5
- old
+ new
@@ -43,11 +43,11 @@
def trim_to(ts)
pointer = nil
@checkpoints.trim_while do |s, p|
pointer = p
- s < ts
+ (s || 0) < ts
end
@data.trim_to(pointer)
return
end
@@ -55,11 +55,11 @@
# Get a pointer to our location in the data.
start_pointer = nil
end_pointer = nil
prev_p = nil
@checkpoints.enum.each do |s, p|
- start_pointer ||= p if start_ts <= s
- end_pointer ||= prev_p if end_ts && end_ts <= s
+ start_pointer ||= p if start_ts <= (s || 0)
+ end_pointer ||= prev_p if end_ts && end_ts <= (s || 0)
break if start_pointer && (end_ts.nil? || end_pointer)
prev_p = p
end
start_pointer ||= @data.tail_pointer
end_pointer ||= @data.tail_pointer