Class: SRTParser

Inherits:
Object
  • Object
show all
Defined in:
lib/rsrt/srt_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(srt_file_path) ⇒ SRTParser

Returns a new instance of SRTParser.



7
8
9
10
11
12
13
14
# File 'lib/rsrt/srt_parser.rb', line 7

def initialize(srt_file_path)
  @srt_file_path = srt_file_path
  @regex_subtitle_id = Regexp.new('^\d+$')
  @regex_time_range = Regexp.new('^\d{2}:\d{2}:\d{2},\d{3} --> \d{2}:\d{2}:\d{2},\d{3}$')
  @regex_text = Regexp.new('^.+$')
  @subtitles = Array.new
  parse
end

Instance Attribute Details

#subtitlesObject (readonly)

Returns the value of attribute subtitles.



5
6
7
# File 'lib/rsrt/srt_parser.rb', line 5

def subtitles
  @subtitles
end