Class: Atoyrobot::Commands::Base
- Inherits:
-
Object
- Object
- Atoyrobot::Commands::Base
show all
- Extended by:
- Dry::Initializer
- Defined in:
- lib/atoyrobot/commands/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.descendants_names ⇒ Object
11
12
13
14
15
16
|
# File 'lib/atoyrobot/commands/base.rb', line 11
def self.descendants_names
ObjectSpace
.each_object(Class)
.select { |klass| klass < self }
.map { |klass| klass.name.split('::').last }
end
|
Instance Method Details
#execute(robot) ⇒ Object
18
19
20
21
|
# File 'lib/atoyrobot/commands/base.rb', line 18
def execute(robot)
action = self.class.name.split('::').last.downcase
robot.send(action)
end
|