class Input

Public Class Methods

new(input) click to toggle source
# File lib/another_toy_robot/input.rb, line 9
def initialize(input)
  @input = input.strip.downcase
end

Public Instance Methods

basename() click to toggle source
# File lib/another_toy_robot/input.rb, line 13
def basename
  @basename ||= @input.split(" ").first
end
params() click to toggle source
# File lib/another_toy_robot/input.rb, line 17
def params
  @params ||= @input.split(" ").drop 1
end
to_class() click to toggle source
# File lib/another_toy_robot/input.rb, line 21
def to_class
  klass = "#{basename.capitalize}Command"
  return InvalidCommand unless Object.const_defined? klass
  Object.const_get klass
end