Class: Readwise::CLI::CommandRegistry
- Inherits:
-
Object
- Object
- Readwise::CLI::CommandRegistry
- Defined in:
- lib/readwise/cli/command_registry.rb
Class Method Summary collapse
- .all_commands ⇒ Object
- .find(resource, action) ⇒ Object
- .register(resource, action, command_class) ⇒ Object
Class Method Details
.all_commands ⇒ Object
16 17 18 |
# File 'lib/readwise/cli/command_registry.rb', line 16 def self.all_commands @commands.keys.map { |key| key.split(':') } end |
.find(resource, action) ⇒ Object
11 12 13 14 |
# File 'lib/readwise/cli/command_registry.rb', line 11 def self.find(resource, action) key = "#{resource}:#{action}" @commands[key] end |
.register(resource, action, command_class) ⇒ Object
6 7 8 9 |
# File 'lib/readwise/cli/command_registry.rb', line 6 def self.register(resource, action, command_class) key = "#{resource}:#{action}" @commands[key] = command_class end |