Class: Minuteman::TimeSpan

Inherits:
Object
  • Object
show all
Includes:
BitOperations
Defined in:
lib/minuteman/time_span.rb

Direct Known Subclasses

Day, Hour, Minute, Month, Week, Year

Constant Summary collapse

DATE_FORMAT =
"%s-%02d-%02d"
TIME_FORMAT =
"%02d:%02d"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BitOperations

#&, #-, #-@, #^, #include?, #length, #reset, #|

Constructor Details

#initialize(redis, event_name, date) ⇒ TimeSpan

Public: Initializes the base TimeSpan class

redis      - The Redis connection
event_name - The event to be tracked
date       - A given Time object


18
19
20
21
# File 'lib/minuteman/time_span.rb', line 18

def initialize(redis, event_name, date)
  @redis = redis
  @key = build_key(event_name, time_format(date))
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



7
8
9
# File 'lib/minuteman/time_span.rb', line 7

def key
  @key
end

#redisObject (readonly)

Returns the value of attribute redis.



7
8
9
# File 'lib/minuteman/time_span.rb', line 7

def redis
  @redis
end