class SwitchDb::Cli

Public Class Methods

run!(command, arguments = {}) click to toggle source
# File lib/switch_db/cli.rb, line 4
def run!(command, arguments = {})
  command_class = command_for(command)
  reference_set = ReferenceSet.load_file(SwitchDb.configuration.reference_set_file_full_path)
  command_class.new(reference_set: reference_set).run(arguments)
  reference_set.write_reference_set
end

Private Class Methods

command_for(command) click to toggle source
# File lib/switch_db/cli.rb, line 13
def command_for(command)
  Command.const_get(Utils.classify(command.to_s))
rescue NameError
  raise CommandNotFound, "#{command} is unknown command."
end