Class: Timestream::Hamster::Fact

Inherits:
Object
  • Object
show all
Defined in:
lib/timestream/hamster.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, start_timestamp, end_timestamp, description, activity_name, activity_id, category_name, tag_list, date_timestamp, delta_in_seconds) ⇒ Fact

Returns a new instance of Fact.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/timestream/hamster.rb', line 15

def initialize(id, start_timestamp, end_timestamp, description, activity_name, activity_id, category_name, tag_list, date_timestamp, delta_in_seconds)
  @id = id
  
  # Convert start and end to Times
  @start_time = Time.at(start_timestamp)
  @end_time = Time.at(end_timestamp)
  
  @description = description
  @activity_name = activity_name
  @activity_id = activity_id
  @category_name = category_name
  @tag_list = tag_list
  
  # Convert date to a Date
  date_time = Time.at(date_timestamp)
  date = Date.new(date_time.year, date_time.month, date_time.day)
  @date = date
  
  @delta_in_seconds = delta_in_seconds
end

Instance Attribute Details

#category_nameObject (readonly)

Returns the value of attribute category_name.



11
12
13
# File 'lib/timestream/hamster.rb', line 11

def category_name
  @category_name
end

#dateObject (readonly)

Returns the value of attribute date.



12
13
14
# File 'lib/timestream/hamster.rb', line 12

def date
  @date
end

#delta_in_secondsObject (readonly)

Returns the value of attribute delta_in_seconds.



13
14
15
# File 'lib/timestream/hamster.rb', line 13

def delta_in_seconds
  @delta_in_seconds
end