class RubberBand::Options

Constants

BINARY_OPTIONS

Public Class Methods

new(options={}) click to toggle source
# File lib/rubberband/options.rb, line 8
def initialize(options={})
  merge!(options)
end

Private Class Methods

convert_binary_params(name) click to toggle source
# File lib/rubberband/options.rb, line 56
def self.convert_binary_params(name)
  class_eval "
  private
  def convert_#{name}(value)
    if value
      '--#{name}'
    else
      ''
    end
  end"
end

Public Instance Methods

to_s() click to toggle source
# File lib/rubberband/options.rb, line 12
def to_s
  params = collect do |key, value|
    send("convert_#{key}", value) if value && supports_option?(key)
  end

  params_string = params.join(" ")
  params_string << " -q"
  params_string
end

Private Instance Methods

convert_crisp(value) click to toggle source
# File lib/rubberband/options.rb, line 52
def convert_crisp(value)
  "--crisp #{value}"
end
convert_duration(value) click to toggle source
# File lib/rubberband/options.rb, line 36
def convert_duration(value)
  "--duration #{value}"
end
convert_frequency(value) click to toggle source
# File lib/rubberband/options.rb, line 44
def convert_frequency(value)
  "--frequency #{value}"
end
convert_pitch(value) click to toggle source
# File lib/rubberband/options.rb, line 40
def convert_pitch(value)
  "--pitch #{value}"
end
convert_tempo(value) click to toggle source
# File lib/rubberband/options.rb, line 32
def convert_tempo(value)
  "--tempo #{value}"
end
convert_time(value) click to toggle source
# File lib/rubberband/options.rb, line 28
def convert_time(value)
  "--time #{value}"
end
convert_timemap(value) click to toggle source
# File lib/rubberband/options.rb, line 48
def convert_timemap(value)
  "--timemap \"#{value}\""
end
supports_option?(option) click to toggle source
# File lib/rubberband/options.rb, line 23
def supports_option?(option)
  option = RUBY_VERSION < "1.9" ? "convert_#{option}" : "convert_#{option}".to_sym
  private_methods.include?(option)
end