class Toycol::Command

Public Class Methods

new(argv) click to toggle source
# File lib/toycol/command.rb, line 133
def initialize(argv)
  @argv = argv
end
run(argv) click to toggle source
# File lib/toycol/command.rb, line 129
def self.run(argv)
  new(argv).execute
end

Public Instance Methods

execute() click to toggle source
# File lib/toycol/command.rb, line 137
def execute
  options = Options.parse!(@argv)
  command = options.delete(:command)

  case command
  when "client", "c"
    Client.execute!(options[:request_message])
  when "server", "s"
    ARGV.push("-q", "-s", "toycol")
    Rack::Server.start
  when "generate", "g"
    type = options[:template_type] || "all"
    TemplateGenerator.generate!(type: type, name: options[:protocol_name])
  end
end