Class: SwitchDb::Command::Config

Inherits:
Base
  • Object
show all
Defined in:
lib/switch_db/command/config.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from SwitchDb::Command::Base

Instance Method Details

#run(arguments = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/switch_db/command/config.rb', line 6

def run(arguments = {})
  arguments.each do |key, value|
    if SwitchDb.configuration.configuration_keys.include?(key.to_sym)
      SwitchDb.configuration.public_send("#{key}=", value)
    else
      raise SwitchDb::UnknownConfigurationKey, "Unknown configuration given (#{key})"
    end
  end

  SwitchDb.configuration.write_configuration_file
end