class KTools::Application

Public Class Methods

new(args) click to toggle source
# File lib/ktools/application.rb, line 3
def initialize(args)
  Setup.perform unless Setup.done?

  @config = Setup.load
  @command = args[0]
  @tail = drop_first_arg(args)
end

Public Instance Methods

start() click to toggle source
# File lib/ktools/application.rb, line 11
def start
  case @command
  when 'spy'
    Tools::Spy.start(@tail)
  when 'deliver'
    Tools::Deliver.start(@tail)
  when 'swap'
    Tools::Swap.start(@tail)
  when 'setup'
    Setup.perform
  else
    Tools::Help.display
  end
end

Private Instance Methods

drop_first_arg(args) click to toggle source
# File lib/ktools/application.rb, line 28
def drop_first_arg(args)
  args.drop(1)
end