mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
CommandSet is Enumerable.
This commit is contained in:
parent
6999d7f1ed
commit
329983354c
1 changed files with 11 additions and 0 deletions
|
@ -31,6 +31,7 @@ class Pry
|
|||
end
|
||||
end
|
||||
|
||||
include Enumerable
|
||||
include Pry::Helpers::BaseHelpers
|
||||
|
||||
attr_reader :commands
|
||||
|
@ -121,6 +122,16 @@ class Pry
|
|||
commands[name] = Command.new(name, description, options, block)
|
||||
end
|
||||
|
||||
def each &block
|
||||
if block_given?
|
||||
@commands.each do |name, struct|
|
||||
yield(name, struct)
|
||||
end
|
||||
else
|
||||
@commands.to_enum
|
||||
end
|
||||
end
|
||||
|
||||
# Removes some commands from the set
|
||||
# @param [Array<String>] names name of the commands to remove
|
||||
def delete(*names)
|
||||
|
|
Loading…
Reference in a new issue