Sha256: bb18a280bd0b8950a4fcdc7230e918e320d2714ce8a570b665552ce2e86f8a39

Contents?: true

Size: 494 Bytes

Versions: 16

Compression:

Stored size: 494 Bytes

Contents

class Hash

  # Turn a hash into arguments.
  #
  #   h = { :list => [1,2], :base => "HI" }
  #   h.argumentize #=> [ [], { :list => [1,2], :base => "HI" } ]
  #   h.argumentize(:list)   #=> [ [1,2], { :base => "HI" } ]
  #   h.argumentize(:base)   #=> [ ["HI"], { :list => [1,2] } ]
  #
  def argumentize(args_field=nil)
    config = dup
    if args_field
      args = [config.delete(args_field)].flatten.compact
    else
      args = []
    end
    args << config
    return args
  end

end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
facets-2.8.4 lib/core/facets/hash/argumentize.rb
facets-2.8.3 lib/core/facets/hash/argumentize.rb
facets-2.8.2 lib/core/facets/hash/argumentize.rb
facets-2.8.1 lib/core/facets/hash/argumentize.rb
facets-2.8.0 lib/core/facets/hash/argumentize.rb
facets-2.7.0 lib/core/facets/hash/argumentize.rb
facets-2.6.0 lib/core/facets/hash/argumentize.rb
facets-2.4.1 lib/facets/hash/argumentize.rb
facets-2.4.4 lib/core/facets/hash/argumentize.rb
facets-2.4.3 lib/core/facets/hash/argumentize.rb
facets-2.4.2 lib/core/facets/hash/argumentize.rb
facets-2.5.1 lib/core/facets/hash/argumentize.rb
facets-2.4.5 lib/core/facets/hash/argumentize.rb
facets-2.5.0 lib/core/facets/hash/argumentize.rb
facets-2.5.2 lib/core/facets/hash/argumentize.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/core/facets/hash/argumentize.rb