module CrawlStation::Command

Constants

ALIASES

Public Instance Methods

invoke(command, args) click to toggle source
# File lib/crawl_station/command.rb, line 6
def invoke(command, args)
  klass = "CrawlStation::Command::#{command.capitalize}".camelize.constantize
  m_name = method_name(command, args)
  obj = klass.new
  return obj.send(m_name, args) if obj.respond_to?(m_name)
  true
rescue Errno::ENOENT, RuntimeError => e
  Logger.warn "#{e.message}\n#{e.backtrace[0..10].join("\n")}"
end
method_name(command, args) click to toggle source
# File lib/crawl_station/command.rb, line 16
def method_name(command, args)
  return 'create' if command.to_s == 'create'
  name = args.shift
  ALIASES[name] || name
end