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(time_on, time_off, text) ⇒ Subline

time_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(time_on, time_off, text)          
  @time_on, @time_off = filter(time_on, time_off)
  # ugly FIXME: when pseudo uses time => 3 or TT format
  # need to add seconds on time_off to time_on
  @time_off += @time_on if @time_off < @time_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

#time_offObject

Returns the value of attribute time_off.



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

def time_off
  @time_off
end

#time_onObject

Returns the value of attribute time_on.



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

def time_on
  @time_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