Class: Subdelayer::Delayer
- Inherits:
-
Object
- Object
- Subdelayer::Delayer
- Defined in:
- lib/subdelayer.rb
Instance Method Summary collapse
-
#initialize(delay:, filename:) ⇒ Delayer
constructor
A new instance of Delayer.
- #perform ⇒ Object
Constructor Details
#initialize(delay:, filename:) ⇒ Delayer
Returns a new instance of Delayer.
20 21 22 23 |
# File 'lib/subdelayer.rb', line 20 def initialize(delay:, filename:) @delay = delay @filename = filename end |
Instance Method Details
#perform ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/subdelayer.rb', line 25 def perform r = chunks.map do |(index, time, *text)| raise NotASubtitleFileError unless time&.include?('-->') [index, delay_time(time), *text].join("\n") end.join("\n\n") end |