Sha256: a21f816485ab5d16e02dcb384bdd5077fee13d59d65bdb4947a44dea7d33b770
Contents?: true
Size: 533 Bytes
Versions: 2
Compression:
Stored size: 533 Bytes
Contents
module Robot module Commands class Place < Base extend PlaceCommandParser REGEX = /^\A(PLACE) \d,\d,(NORTH|EAST|WEST|SOUTH)\z/ 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
robot_rea-0.1.5 | lib/robot/commands/place.rb |
robot_rea-0.1.4 | lib/robot/commands/place.rb |