Class: PryCommandSetRegistry::CommandSet
- Inherits:
-
Pry::CommandSet
- Object
- Pry::CommandSet
- PryCommandSetRegistry::CommandSet
- Defined in:
- lib/pry_command_set_registry/command_set.rb
Overview
A set of commands that can me imported into a Pry session.
Constant Summary collapse
- DEFAULT_GROUP_NAME =
The default group name that Pry gives to commands without a group.
"(other)".freeze
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
The description of the command set provided at creation.
-
#group ⇒ Object
readonly
The group name given to the command set at creation.
-
#name ⇒ Object
readonly
The name of the command set provided at creation.
Instance Method Summary collapse
- #extend(*modules) ⇒ Object
-
#initialize(name, description, options = {}) { ... } ⇒ PryCommandSetRegistry::CommandSet
constructor
Creates a new command set.
Constructor Details
#initialize(name, description, options = {}) { ... } ⇒ PryCommandSetRegistry::CommandSet
Creates a new command set.
39 40 41 42 43 44 45 46 |
# File 'lib/pry_command_set_registry/command_set.rb', line 39 def initialize(name, description, = {}, &block) raise ArgumentError, "Block required!" unless block_given? super(&block) @description = description @name = name.to_s @group = [:group] || DEFAULT_GROUP_NAME apply_group_name_to_commands end |
Instance Attribute Details
#description ⇒ Object (readonly)
The description of the command set provided at creation.
8 9 10 |
# File 'lib/pry_command_set_registry/command_set.rb', line 8 def description @description end |
#group ⇒ Object (readonly)
The group name given to the command set at creation.
11 12 13 |
# File 'lib/pry_command_set_registry/command_set.rb', line 11 def group @group end |
#name ⇒ Object (readonly)
The name of the command set provided at creation.
14 15 16 |
# File 'lib/pry_command_set_registry/command_set.rb', line 14 def name @name end |
Instance Method Details
#extend(*modules) ⇒ PryCommandSetRegistry::CommandSet #extend { ... } ⇒ PryCommandSetRegistry::CommandSet
66 67 68 69 70 71 72 73 |
# File 'lib/pry_command_set_registry/command_set.rb', line 66 def extend(*modules) if modules.any? return super unless block_given? raise ArgumentError, "Cannot call extend with block and modules!" end instance_eval(&Proc.new) self end |