Class: PryCommandSetRegistry::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/pry_command_set_registry/registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



5
6
7
# File 'lib/pry_command_set_registry/registry.rb', line 5

def initialize
  @command_sets = {}
end

Instance Attribute Details

#command_setsObject (readonly)

Returns the value of attribute command_sets.



3
4
5
# File 'lib/pry_command_set_registry/registry.rb', line 3

def command_sets
  @command_sets
end

Instance Method Details

#command_set(name) ⇒ Object



9
10
11
12
# File 'lib/pry_command_set_registry/registry.rb', line 9

def command_set(name)
  sanitized_name = name.to_s.sub(/^:/, "")
  command_sets[sanitized_name]
end

#define_command_set(name, description, &block) ⇒ Object



14
15
16
17
# File 'lib/pry_command_set_registry/registry.rb', line 14

def define_command_set(name, description, &block)
  command_set = CommandSet.new(name, description, &block)
  command_sets[command_set.name] = command_set
end