Class: Ned::CommandRegistry
- Inherits:
-
Object
- Object
- Ned::CommandRegistry
- Defined in:
- lib/ned/command_registry.rb
Class Method Summary collapse
Class Method Details
.add(command) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ned/command_registry.rb', line 6 def self.add(command) if @names.key?(command.long_name) raise "duplicate command name \"#{command.long_name}\"" end if @names.key?(command.short_name) raise "duplicate command name \"#{command.short_name}\"" end @names[command.long_name] = command @names[command.short_name] = command @all << command end |
.all ⇒ Object
23 24 25 |
# File 'lib/ned/command_registry.rb', line 23 def self.all @all end |
.find(name) ⇒ Object
19 20 21 |
# File 'lib/ned/command_registry.rb', line 19 def self.find(name) @names[name] end |