Class: EncoderTools::CLI::Subtitles::Offset
- Defined in:
- lib/encoder-tools/cli/subtitles/offset.rb
Constant Summary collapse
- NUMBER =
'(\d+|\d*\.\d+)'- HH_MM_SS_OFFSET =
%r{\A(?:(\d\d?):)?(\d\d?):(\d\d?)\Z}- ABSOLUTE_OFFSET =
%r{\A#{NUMBER}\Z}- NEGATIVE_OFFSET =
%r{\A-#{NUMBER}\Z}- POSITIVE_OFFSET =
%r{\A\+#{NUMBER}\Z}- MIN_PER_HOUR =
60- SEC_PER_MIN =
60
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#parse, #parser, parser, #read, #write
Methods inherited from Base
Constructor Details
This class inherits a constructor from EncoderTools::CLI::Base
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/encoder-tools/cli/subtitles/offset.rb', line 14 def run value = if [:set] [:set] elsif [:add] "+#{[:add]}" elsif [:subtract] "-#{[:subtract]}" else raise ArgumentError, "Must provide a set, add, or subtract option to determine the offset" end write offset(read, value) end |