class RIPECLINER::CLI

Public Class Methods

new(params) click to toggle source
# File lib/ripecliner/cli.rb, line 5
def initialize(params)
  @command  = params[0]
  @argument = params[1]

  invoke_command
end
print_help() click to toggle source

Public Instance Methods

invoke_command() click to toggle source
# File lib/ripecliner/cli.rb, line 12
def invoke_command
  case @command
  when "download"
    dump = RIPECLINER::BGPDump.new
    dump.date = @argument
    dump.download
  when "convert"
    dump = RIPECLINER::BGPDump.new

    if @argument
      dump.file = @argument
    else
      raise ArgumentError.new("Please, specify dump file for converting / downloading.")
    end

    dump.convert
  when "-h", "--help"
    CLI.print_help
  when "-v", "--version"
    puts RIPECLINER::VERSION
  else
    raise ArgumentError.new("Unrecognized command")
  end
end