class Atoyrobot::CLI
Attributes
stdin[RW]
Public Class Methods
start(_argv = [], args = {})
click to toggle source
# File lib/atoyrobot/cli.rb, line 11 def start(_argv = [], args = {}) self.stdin = args[:input] || STDIN robot = Robot.new loop do raw_input = stdin.gets&.chomp || '' break if raw_input.empty? || raw_input == 'exit' execute(raw_input, robot) end end
Private Class Methods
execute(input, robot)
click to toggle source
# File lib/atoyrobot/cli.rb, line 23 def execute(input, robot) command = Atoyrobot::Parser.parse(input) command.execute(robot) rescue StandardError => e puts e.message end