Array and hash extensions for key-value operations
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
LICENSE
README.rdoc
Rakefile
init.rb
next_gem_version

README.rdoc

Key Value Extensions for Array

A library of key-value operations

Resources

Install

  • sudo gem install key_value_ext

Use

  • require 'key_value_ext'

Description

A key-value array is one with the structure [[key1, val2], [key2, [value2, value3, …]], … ].

This library provides the following functions

  • map_key_value

  • group_key_value

for creating key-value arrays from arrays and hashes, and

  • keys

  • values

  • consolidate

  • expand

  • invert_key_value

  • to_hash

for arrays that are key-value arrays

Usage

Good for laying out complex nested views and forms when group_by is not enough.

See the spec for examples.