Class: Del::Tron

Inherits:
Object
  • Object
show all
Defined in:
lib/del/tron.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(robot, configuration) ⇒ Tron

Returns a new instance of Tron.



7
8
9
10
# File 'lib/del/tron.rb', line 7

def initialize(robot, configuration)
  @robot = robot
  @configuration = configuration
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



5
6
7
# File 'lib/del/tron.rb', line 5

def configuration
  @configuration
end

#robotObject (readonly)

Returns the value of attribute robot.



5
6
7
# File 'lib/del/tron.rb', line 5

def robot
  @robot
end

Instance Method Details

#execute(request) ⇒ Object



12
13
14
15
16
# File 'lib/del/tron.rb', line 12

def execute(request)
  command_for(request)&.call(request) || 'Unknown'
rescue StandardError => error
  error.message
end