Skip to content

Instantly share code, notes, and snippets.

@coderberry
Created April 20, 2009 22:29
Show Gist options
  • Select an option

  • Save coderberry/98806 to your computer and use it in GitHub Desktop.

Select an option

Save coderberry/98806 to your computer and use it in GitHub Desktop.
class SoxEncoder
attr_accessor :input_files, :output_file, :command_line
def initialize
@input_files = []
end
def input_file=(filename)
@input_files << filename
end
def convert
if @input_files.length > 0
@command_line = "sox #{@input_files.join(' ')} #{@output_file}"
else
raise ArgumentError, "No input file specified."
end
return run_command
end
def run_command
raise ArgumentError, "No output file specified." unless @output_file
puts @command_line
if system @command_line
return true
else
return false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment