Class: WebVTT::Cue

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

Constant Summary collapse

VOICE_SPAN_REGEX =
/<v\.?([\w\.]*?) (.*?)\>(.*)/

Instance Method Summary collapse

Instance Method Details

#raw_textObject



10
# File 'lib/vtt2an/webvtt/cue.rb', line 10

alias_method :raw_text, :text

#speakerObject



5
6
7
8
# File 'lib/vtt2an/webvtt/cue.rb', line 5

def speaker 
  raw_text =~ VOICE_SPAN_REGEX
  $2 || "Speaker"
end

#textObject



12
13
14
15
# File 'lib/vtt2an/webvtt/cue.rb', line 12

def text
  raw_text =~ VOICE_SPAN_REGEX
  $3 || raw_text
end

#voice_spanObject



17
18
19
20
21
22
23
24
# File 'lib/vtt2an/webvtt/cue.rb', line 17

def voice_span
  raw_text =~ VOICE_SPAN_REGEX
  if $1
    $1.split(".")
  else
    []
  end
end