From 4194da19c60956f6e59239c0145f772be257e79d Mon Sep 17 00:00:00 2001 From: John Bellone Date: Thu, 12 Dec 2013 09:38:50 -0500 Subject: [PATCH] [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}" } ``` --- lib/vagrant/registry.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/vagrant/registry.rb b/lib/vagrant/registry.rb index df8147c9e..e69574ed8 100644 --- a/lib/vagrant/registry.rb +++ b/lib/vagrant/registry.rb @@ -34,6 +34,13 @@ module Vagrant def has_key?(key) @items.has_key?(key) end + + # Returns an array populated with the keys of this object. + # + # @return [Array] + def keys + @items.keys + end # Iterate over the keyspace. def each(&block)