Class: Event

Inherits:
Object
  • Object
show all
Defined in:
lib/repo_timetracker/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string, following_time_spent = nil) ⇒ Event

Returns a new instance of Event.



4
5
6
7
8
# File 'lib/repo_timetracker/event.rb', line 4

def initialize(string, following_time_spent = nil)
  @string = string
  @time_recorded = Time.now
  @following_time_spent = following_time_spent || :working
end

Instance Attribute Details

#following_time_spentObject

Returns the value of attribute following_time_spent.



2
3
4
# File 'lib/repo_timetracker/event.rb', line 2

def following_time_spent
  @following_time_spent
end

#stringObject

Returns the value of attribute string.



2
3
4
# File 'lib/repo_timetracker/event.rb', line 2

def string
  @string
end

#time_recordedObject

Returns the value of attribute time_recorded.



2
3
4
# File 'lib/repo_timetracker/event.rb', line 2

def time_recorded
  @time_recorded
end

Instance Method Details

#==(other_event) ⇒ Object



14
15
16
17
18
# File 'lib/repo_timetracker/event.rb', line 14

def ==(other_event)
  @string == other_event.string and 
  @time_recorded == other_event.time_recorded and 
  @following_time_spent == other_event.following_time_spent
end

#following_time_spent_working?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/repo_timetracker/event.rb', line 10

def following_time_spent_working?
  following_time_spent == :working
end