Class: Sox::Command::File

Inherits:
Object
  • Object
show all
Defined in:
lib/sox/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, options = {}) ⇒ File

Returns a new instance of File.



150
151
152
153
# File 'lib/sox/command.rb', line 150

def initialize(filename, options = {})
  @filename = filename
  @options = options
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



148
149
150
# File 'lib/sox/command.rb', line 148

def filename
  @filename
end

#optionsObject

Returns the value of attribute options.



148
149
150
# File 'lib/sox/command.rb', line 148

def options
  @options
end

Instance Method Details

#==(other) ⇒ Object



168
169
170
171
172
# File 'lib/sox/command.rb', line 168

def ==(other)
  other and 
    other.filename == filename and 
    other.options == options
end

#command_argumentsObject



155
156
157
158
159
160
161
162
# File 'lib/sox/command.rb', line 155

def command_arguments
  unless options.empty?
    format_options = sorted_options.collect do |name, value|
      "--#{name} #{value}"
    end.join(' ') + " "
  end
  "#{format_options}#{filename}"
end

#sorted_optionsObject



164
165
166
# File 'lib/sox/command.rb', line 164

def sorted_options
  options.to_a.sort_by { |pair| pair.first.to_s }
end