Class: Counterman::TimeSpan

Inherits:
Object
  • Object
show all
Includes:
HashOperations
Defined in:
lib/counterman/time_span.rb

Overview

Public: The timespan class. All the time span classes inherit from this one

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 HashOperations

#all_counts, #count, #count_all

Constructor Details

#initialize(event_name, date) ⇒ TimeSpan

Public: Initializes the base TimeSpan class

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


21
22
23
# File 'lib/counterman/time_span.rb', line 21

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

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



11
12
13
# File 'lib/counterman/time_span.rb', line 11

def key
  @key
end