Class: Media::Command::Converter
- Inherits:
-
Object
- Object
- Media::Command::Converter
- Defined in:
- lib/media/command/converter.rb
Instance Attribute Summary collapse
-
#inputs ⇒ Object
Returns the value of attribute inputs.
-
#options ⇒ Object
Returns the value of attribute options.
-
#outputs ⇒ Object
Returns the value of attribute outputs.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args = {}) ⇒ Converter
constructor
A new instance of Converter.
- #to_s ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Converter
Returns a new instance of Converter.
9 10 11 12 13 14 15 16 |
# File 'lib/media/command/converter.rb', line 9 def initialize(args={}) @options = Array args.fetch(:options, []) @inputs = Array args.fetch(:inputs, []) @outputs = Array args.fetch(:outputs, []) @cmd = args.fetch(:cmd, 'ffmpeg') @subshell = args.fetch(:subshell, Subshell) end |
Instance Attribute Details
#inputs ⇒ Object
Returns the value of attribute inputs.
7 8 9 |
# File 'lib/media/command/converter.rb', line 7 def inputs @inputs end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/media/command/converter.rb', line 7 def @options end |
#outputs ⇒ Object
Returns the value of attribute outputs.
7 8 9 |
# File 'lib/media/command/converter.rb', line 7 def outputs @outputs end |
Instance Method Details
#call ⇒ Object
18 19 20 |
# File 'lib/media/command/converter.rb', line 18 def call @subshell.new(cmd: to_s).call end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/media/command/converter.rb', line 22 def to_s [@cmd, , inputs, outputs].reject(&:empty?).join(' ') end |