Class: Tucue::Marker::Mark

Inherits:
Struct
  • Object
show all
Defined in:
lib/tucue/marker.rb

Overview

A single mark: time is the playback position in seconds and label is an optional user-supplied note.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



11
12
13
# File 'lib/tucue/marker.rb', line 11

def label
  @label
end

#timeObject

Returns the value of attribute time

Returns:

  • (Object)

    the current value of time



11
12
13
# File 'lib/tucue/marker.rb', line 11

def time
  @time
end

Instance Method Details

#timestampObject

Format the time as HH:MM:SS.



13
14
15
16
# File 'lib/tucue/marker.rb', line 13

def timestamp
  total = time.to_i
  format("%02d:%02d:%02d", total / 3600, (total % 3600) / 60, total % 60)
end

#to_hObject



18
19
20
# File 'lib/tucue/marker.rb', line 18

def to_h
  {timestamp: timestamp, seconds: time.to_f.round(3), label: label}
end