lib/bovem/command.rb in bovem-3.0.2 vs lib/bovem/command.rb in bovem-3.0.3

- old
+ new

@@ -75,13 +75,13 @@ # Adjusts options names for printing. # # @return [Hash] The adjusted options for printing. def show_help_options_build_labels - options.values.inject({}) do |lefts, option| + options.values.reduce({}) do |lefts, option| left = [option.complete_short, option.complete_long] - left.collect!{|l| l + " " + option.meta } if option.requires_argument? + left.map!{|l| l + " " + option.meta } if option.requires_argument? lefts[left.join(", ")] = option.has_help? ? option.help : i18n.help_no_description lefts end end @@ -89,11 +89,11 @@ # # @param console [Bovem::Console] The console object to use to print. # @param lefts [Hash] The list of adjusted options. # @param head [String] The option to print. def show_help_option(console, lefts, head) - alignment = lefts.keys.collect(&:length).max + alignment = lefts.keys.map(&:length).max help = lefts[head] console.write("%s - %s" % [head.ljust(alignment, " "), help], "\n", true, true) end # Prints information about the command's subcommands. @@ -113,11 +113,11 @@ # # @param console [Bovem::Console] The console object to use to print. def prepare_show_help_commands(console) console.write("") console.write(is_application? ? i18n.help_commands : i18n.help_subcommands) - commands.keys.collect(&:length).max + commands.keys.map(&:length).max end # Prints information about a command's subcommand. # # @param name [String] The name of command to print. @@ -266,10 +266,10 @@ # @param prefix [String] The prefix to add to the option of this command. # @param whitelist [Array] The list of options to include. By default all options are included. # @return [HashWithIndifferentAccess] The requested options. def get_current_options(unprovided, prefix, whitelist) rv = HashWithIndifferentAccess.new - whitelist = (whitelist.present? ? whitelist : options.keys).collect(&:to_s) + whitelist = (whitelist.present? ? whitelist : options.keys).map(&:to_s) options.each do |key, option| rv["#{prefix}#{key}"] = option.value if include_option?(whitelist, unprovided, key, option) end \ No newline at end of file