Class: Logbook::TaskEntry

Inherits:
Struct
  • Object
show all
Defined in:
lib/logbook/task_entry.rb

Constant Summary collapse

DATE_PROPERTY_NAME =
"Date"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#line_numberObject

Returns the value of attribute line_number

Returns:

  • (Object)

    the current value of line_number



4
5
6
# File 'lib/logbook/task_entry.rb', line 4

def line_number
  @line_number
end

#noteObject

Returns the value of attribute note

Returns:

  • (Object)

    the current value of note



4
5
6
# File 'lib/logbook/task_entry.rb', line 4

def note
  @note
end

#propertiesObject

Returns the value of attribute properties

Returns:

  • (Object)

    the current value of properties



4
5
6
# File 'lib/logbook/task_entry.rb', line 4

def properties
  @properties
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



4
5
6
# File 'lib/logbook/task_entry.rb', line 4

def status
  @status
end

#tagsObject

Returns the value of attribute tags

Returns:

  • (Object)

    the current value of tags



4
5
6
# File 'lib/logbook/task_entry.rb', line 4

def tags
  @tags
end

#timeObject

Returns the value of attribute time

Returns:

  • (Object)

    the current value of time



4
5
6
# File 'lib/logbook/task_entry.rb', line 4

def time
  @time
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



4
5
6
# File 'lib/logbook/task_entry.rb', line 4

def title
  @title
end

Instance Method Details

#merge_page_properties(properties) ⇒ Object



7
8
9
# File 'lib/logbook/task_entry.rb', line 7

def merge_page_properties(properties)
  self.properties = properties.merge(self.properties)
end

#recorded_atObject



11
12
13
14
15
16
17
# File 'lib/logbook/task_entry.rb', line 11

def recorded_at
  date = self.properties[DATE_PROPERTY_NAME]
  time = self.time

  DateTime.parse(date + " " + time)
rescue ArgumentError
end

#starts_clock?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/logbook/task_entry.rb', line 19

def starts_clock?
  [Task::START, Task::RESUME, Task::REOPEN].include?(self.status)
end

#stops_clock?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/logbook/task_entry.rb', line 23

def stops_clock?
  true
end