Class: AudioSwitch::Pactl::ModuleOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/audio_switch/pactl.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ModuleOptions

Returns a new instance of ModuleOptions.



166
167
168
# File 'lib/audio_switch/pactl.rb', line 166

def initialize(options)
  @options = options
end

Instance Method Details

#format(opts, quote = '') ⇒ Object



174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/audio_switch/pactl.rb', line 174

def format(opts, quote = '')
  result = ''
  opts.each_pair do |key, value|
    result += ' ' unless result.empty?
    result += if value.is_a? Hash
                "#{key}=\\\"#{format(value, '\\\'')}\\\""
              else
                "#{key}=#{quote}#{value}#{quote}"
              end
  end
  result
end

#to_sObject



170
171
172
# File 'lib/audio_switch/pactl.rb', line 170

def to_s
  format(@options)
end