1
0
Fork 0
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:
Rob Gleeson 2011-05-30 11:56:50 +01:00
parent 6999d7f1ed
commit 329983354c

View file

@ -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)