Class: Av::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/av/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Cli

Returns a new instance of Cli.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/av/cli.rb', line 5

def initialize(options)
  found = []
  found << 'avconv' if self.detect_command('avprobe')
  found << 'ffmpeg' if self.detect_command('ffmpeg')
  if found.empty?
    raise Av::UnableToDetect, "Unable to detect any supported library"
  else
    @command = Object.const_get('Av').const_get('Commands').const_get(found.first.capitalize).new(options)
  end
  ::Av.log("Found #{found.inspect}, using: #{found.first.capitalize}")
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (protected)



18
19
20
# File 'lib/av/cli.rb', line 18

def method_missing name, *args, &block
  @command.send(name, *args, &block)
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



3
4
5
# File 'lib/av/cli.rb', line 3

def command
  @command
end