Class: Readwise::CLI::CommandRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/readwise/cli/command_registry.rb

Class Method Summary collapse

Class Method Details

.all_commandsObject



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