Class: SubtitleIt::Subline

Inherits:
Object
  • Object
show all
Defined in:
lib/subtitle_it/subline.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text_on, text_off, text) ⇒ Subline

text_on/off may be: HH:MM:SS,MMM MM:SS S text lines should be separated by |



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

def initialize(text_on, text_off, text)          
  @text_on, @text_off = filter(text_on, text_off)
  # ugly FIXME: when pseudo uses time => 3
  # need to add seconds from the first sub
  @text_off += @text_on if @text_off < @text_on
  @text = text
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



5
6
7
# File 'lib/subtitle_it/subline.rb', line 5

def text
  @text
end

#text_offObject

Returns the value of attribute text_off.



5
6
7
# File 'lib/subtitle_it/subline.rb', line 5

def text_off
  @text_off
end

#text_onObject

Returns the value of attribute text_on.



5
6
7
# File 'lib/subtitle_it/subline.rb', line 5

def text_on
  @text_on
end

Instance Method Details

#filter(*args) ⇒ Object



19
20
21
22
23
# File 'lib/subtitle_it/subline.rb', line 19

def filter(*args)
  args.map do |arg|
    Subtime.new(arg)
  end
end