Class: LocoBot::CLI::Command::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/loco_bot/cli/command/base.rb

Overview

Parent class for Command classes.

Direct Known Subclasses

Hodor, Left, Move, Place, Report, Right

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(robot, table) ⇒ Base

Returns a new instance of Base.



14
15
16
17
# File 'lib/loco_bot/cli/command/base.rb', line 14

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

Instance Attribute Details

#robotRobot (readonly)

Returns the Robot.

Returns:



8
9
10
# File 'lib/loco_bot/cli/command/base.rb', line 8

def robot
  @robot
end

#tableTable (readonly)

Returns the Table.

Returns:



8
# File 'lib/loco_bot/cli/command/base.rb', line 8

attr_reader :robot

Class Method Details

.labelString

Returns the Command’s label.

Returns:

  • (String)

    the Command’s label



21
22
23
# File 'lib/loco_bot/cli/command/base.rb', line 21

def self.label
  name.split('::').last.upcase
end