Sha256: 0640a5239a57ed4bba120650efb4113b1edbe08ea6e36da17d7dd9db2bc0c8f6
Contents?: true
Size: 591 Bytes
Versions: 4
Compression:
Stored size: 591 Bytes
Contents
# frozen_string_literal: true module Robot module Commands # Place Command class Place < Base extend PlaceCommandParser REGEX = /^\A(PLACE) \d,\d,(NORTH|EAST|WEST|SOUTH)\z/.freeze def self.matches?(command) command =~ REGEX end def self.call(x:, y:, f:) Robot::Position.new(point: Point.new(x: x, y: y), direction: f) end def self.build_from_string_command(command) x, y, f = parse(command) x = x.to_i y = y.to_i f = f.to_sym call(x: x, y: y, f: f) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
robot_rea-0.1.9 | lib/robot/commands/place.rb |
robot_rea-0.1.8 | lib/robot/commands/place.rb |
robot_rea-0.1.7 | lib/robot/commands/place.rb |
robot_rea-0.1.6 | lib/robot/commands/place.rb |