class Robotoy::Services::Report

Public Class Methods

new(robot:, type:) click to toggle source
# File lib/robotoy/services/report.rb, line 4
def initialize(robot:, type:)
  @robot = robot
  @type = type
end

Public Instance Methods

perform() click to toggle source
# File lib/robotoy/services/report.rb, line 9
def perform
  @robot.validate_if_placed
  send(@type)
end

Private Instance Methods

console() click to toggle source
# File lib/robotoy/services/report.rb, line 16
def console
  puts "Output: #{string}"
end
method_missing(_name, *_args) click to toggle source
# File lib/robotoy/services/report.rb, line 24
def method_missing(_name, *_args)
  raise Robotoy::NotValidMethodError
end
string() click to toggle source
# File lib/robotoy/services/report.rb, line 20
def string
  "#{@robot.x},#{@robot.y},#{@robot.orientation.upcase}"
end