class Subber::Subtitle
Attributes
content[R]
counter[R]
end_time[R]
start_time[R]
Public Class Methods
new(attributes)
click to toggle source
# File lib/subber/subtitle.rb, line 7 def initialize(attributes) @counter = attributes[:counter] @start_time = attributes[:start_time] @end_time = attributes[:end_time] @content = attributes[:content] end
Public Instance Methods
as_json()
click to toggle source
# File lib/subber/subtitle.rb, line 14 def as_json { 'counter' => counter, 'start_time' => start_time, 'end_time' => end_time, 'content' => content } end
shift(ms)
click to toggle source
@param miliseconds [Integer] Can be both positive and negative @return [Subber::Subtitle] return a copy with shifted subtitle
# File lib/subber/subtitle.rb, line 26 def shift(ms) self.class.new( counter: counter, start_time: start_time + ms, end_time: end_time + ms, content: content ) end
shift!(ms)
click to toggle source
@param miliseconds [Integer] Can be both positive and negative mutates the current subtitle's start and end time by ms
# File lib/subber/subtitle.rb, line 38 def shift!(ms) @start_time += ms @end_time += ms end