Sha256: bbb0b8f568a609b68b6460df0690c7b804dcb63fed774e79b0f13e4895fab908
Contents?: true
Size: 976 Bytes
Versions: 8
Compression:
Stored size: 976 Bytes
Contents
module Reap module Extensions # Array Extensions module Array # Not empty? def not_empty? !empty? end # Convert an array into command line parameters. # The array is accepted in the format of Ruby # method arguments --ie. [arg1, arg2, ..., hash] def to_console flags = (Hash===last ? pop : {}) flags = flags.to_console flags + ' ' + join(" ") end alias_method :to_params, :to_console # def to_console # flags = (Hash===last ? pop : {}) # flags = flags.collect do |f,v| # m = f.to_s.size == 1 ? '-' : '--' # case v # when Array # v.collect{ |e| "#{m}#{f} '#{e}'" }.join(' ') # when true # "#{m}#{f}" # when false, nil # '' # else # "#{m}#{f} '#{v}'" # end # end # return (flags + self).join(" ") # end end end end class Array #:nodoc: include Reap::Extensions::Array end
Version data entries
8 entries across 8 versions & 1 rubygems