Sha256: 36f949120aed432166e27c388a36b85070ab111d4f9e10f255c424b2f7105e4a
Contents?: true
Size: 815 Bytes
Versions: 1
Compression:
Stored size: 815 Bytes
Contents
module EncoderTools module Subtitles class List attr_accessor :entries def offset return 0 if entries.empty? entries.first.offset end def offset=(offset) return nil if entries.empty? diff = offset - self.offset entries.each {|subtitle| subtitle.offset += diff} end def to_s str = "" i = 0 entries.each do |subtitle| str << (i += 1).to_s << "\n" << subtitle.to_s << "\n\n" end return str end def each(&block) entries.each(&block) return self end def self.load(input, parser_class=Parser) result = new parser = parser_class.new(input) result.entries = parser.parse return result end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
encoder-tools-1.0.0 | lib/encoder-tools/subtitles/list.rb |