lib/pulse_meter/sensor/timeline.rb
# Drops sensor data within given time
# @param from [Time] lower bound
# @param till [Time] upper bound
# @raise ArgumentError if argumets are not valid time objects
Drops sensor data within given time
Drops sensor data within given time
def drop_within(from, till)
        raise ArgumentError unless from.kind_of?(Time) && till.kind_of?(Time)
        start_time, end_time = time_to_redis(from.to_i), time_to_redis(till.to_i)
        current_interval_id = get_interval_id(start_time) + interval
        keys = []
        while current_interval_id < end_time
          keys << data_key(current_interval_id)
          keys << raw_data_key(current_interval_id)
          current_interval_id += interval
        end
        keys.empty? ? 0 : redis.del(*keys)
      end
def drop_within ( from , till ) raise ArgumentError unless from . kind_of? ( Time ) && till . kind_of? ( Time ) start_time , end_time = time_to_redis ( from . to_i ) , time_to_redis ( till . to_i ) current_interval_id = get_interval_id ( start_time ) + interval keys = [ ] while current_interval_id < end_time keys << data_key ( current_interval_id ) keys << raw_data_key ( current_interval_id ) current_interval_id += interval end keys . empty? ? 0 : redis . del ( * keys ) end
Drops sensor data within given time
Drops sensor data within given time
ArgumentError if argumets are not valid time objects
ArgumentError if argumets are not valid time objects
from
None
till
None