[vagrant] Update Registry with #keys method.
This helper method to return the keys for the registry will give capability to eliminate some code. Example: ```ruby keys = [] @subcommands.each { |k,v| keys << k } keys.sort.each { |k| o.seperator "#{k}" } ``` Versus: ```ruby @subcommands.keys.sort.each { |k| o.seperator "#{k}" } ```
This commit is contained in:
parent
152c6b92ac
commit
4194da19c6
|
@ -35,6 +35,13 @@ module Vagrant
|
||||||
@items.has_key?(key)
|
@items.has_key?(key)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns an array populated with the keys of this object.
|
||||||
|
#
|
||||||
|
# @return [Array]
|
||||||
|
def keys
|
||||||
|
@items.keys
|
||||||
|
end
|
||||||
|
|
||||||
# Iterate over the keyspace.
|
# Iterate over the keyspace.
|
||||||
def each(&block)
|
def each(&block)
|
||||||
@items.each do |key, _|
|
@items.each do |key, _|
|
||||||
|
|
Loading…
Reference in New Issue