RAA - hashslice

hashslice / 1.0.5

Short description: HashSlice
Category: Library/Datastructure
Status: stable
Created: 2002-10-24 15:15:34 GMT
Last update: 2009-07-30 05:30:44 GMT
Owner: Daniel J. Berger (Projects of this owner)
Homepage: http://rubyforge.org/projects/shards/
Download: http://rubyforge.org/frs/download.php/61233/hashslice-1.0.5.tar.gz
License: Artistic
Dependency:
None
Description:

HashSlice is a Ruby module that adds slicing to the builtin Hash class. Slicing is the ability to fetch and assign to more than one key-value pair of the hash.

require 'hashslice'

hash = {'a' => 1, 'b' => 2, 'c' => 3}

# Slice reference
hash['a', 'b'] # -> [1, 2]
hash['a'] # -> 1

# Slice assignment
hash['a', 'b'] = 7, 8

hash # -> {'a' => 7, 'b' => 8, 'c' => 3}

Versions: [1.0.5 (2009-07-30)] [1.0.4 (2008-05-28)] [1.03 (2008-05-23)]

Edit this project (for project owner)

back to RAA top