class Captions::CueList
Public Class Methods
new(frame_rate, list=[])
click to toggle source
Creates a new CueList
# File lib/captions/list.rb, line 6 def initialize(frame_rate, list=[]) @fps = frame_rate @list = list end
Public Instance Methods
[](index)
click to toggle source
Array based enumerables for cuelist
# File lib/captions/list.rb, line 49 def [](index) @list[index] end
append(cue)
click to toggle source
Inserts the subtitle into the CueList
Subtitle is serialized before its inserted
# File lib/captions/list.rb, line 37 def append(cue) cue.serialize(@fps) @list << cue end
each() { |c| ... }
click to toggle source
Iterate through CueList
# File lib/captions/list.rb, line 43 def each return to_enum(:each) unless block_given? @list.each { |c| yield(c) } end
entries()
click to toggle source
Returns the parsed subtitles
# File lib/captions/list.rb, line 17 def entries @list end
fps()
click to toggle source
Returns frame-rate of the list
# File lib/captions/list.rb, line 12 def fps @fps end
frame_rate=(rate)
click to toggle source
Changes the frame rate of CueList
This also changes frame rate in already parsed subtitles
# File lib/captions/list.rb, line 30 def frame_rate=(rate) @list.each { |c| c.change_frame_rate(@fps, rate) } @fps = rate end
inspect()
click to toggle source
Hide all cues when inspecting CueList
Show only necessary info rather than printing everything
# File lib/captions/list.rb, line 23 def inspect "#<Captions::CueList:#{object_id} @fps=#{fps} @cues=#{@list.count}>" end