Class: Webvtt::Cue

Inherits:
Object
  • Object
show all
Defined in:
lib/webvtt/cue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Cue

Returns a new instance of Cue.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/webvtt/cue.rb', line 5

def initialize(opts={})
  if !opts.empty?
    @identifier = opts[:identifier]
    @text       = opts[:text]
    cue_parts = opts[:cue_line].split('-->')
    @start = cue_parts.first.strip
    remaining_cue_parts = cue_parts.last.split(" ")
    @end = remaining_cue_parts.shift.strip
    @settings = remaining_cue_parts.join(' ')
  end

end

Instance Attribute Details

#endObject

Returns the value of attribute end.



4
5
6
# File 'lib/webvtt/cue.rb', line 4

def end
  @end
end

#identifierObject

Returns the value of attribute identifier.



4
5
6
# File 'lib/webvtt/cue.rb', line 4

def identifier
  @identifier
end

#settingsObject

Returns the value of attribute settings.



4
5
6
# File 'lib/webvtt/cue.rb', line 4

def settings
  @settings
end

#startObject

Returns the value of attribute start.



4
5
6
# File 'lib/webvtt/cue.rb', line 4

def start
  @start
end

#textObject

Returns the value of attribute text.



4
5
6
# File 'lib/webvtt/cue.rb', line 4

def text
  @text
end