class Array
Public Instance Methods
power_set()
click to toggle source
@author Phrogz
# File lib/facets/set.rb, line 24 def power_set if empty? [self] else subset = dup value = [ subset.pop ] subsubs = subset.power_set subsubs.concat( subsubs.map{ |subset| subset + value } ) end end
shelljoin()
click to toggle source
# File lib/facets/shellwords.rb, line 78 def shelljoin Shellwords.shelljoin(shellwords) end
shellwords()
click to toggle source
Convert an array into command line parameters. The array is accepted in the format of Ruby method arguments –ie. [arg1, arg2, …, hash]
# File lib/facets/shellwords.rb, line 71 def shellwords opts, args = *flatten.partition{ |e| Hash === e } opts = opts.inject({}){ |m,h| m.update(h); m } opts.shellwords + args end
to_path()
click to toggle source
Convert array to Pathname instance.
@standard
require 'facets/pathname'
# File lib/facets/pathname.rb, line 250 def to_path Pathname.new(join('/')) end
to_t()
click to toggle source
Convert an array into a tuple.
# File lib/facets/tuple.rb, line 276 def to_t Tuple.cast_from_array( self ) end