0.01
No commit activity in last 3 years
No release in over 3 years
Like Set except it maintains the order of objects
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

OrderedSet¶ ↑

OrderSet is an class for storing sets of objects. Unlike a Set, it maintains the order of the objects, but unlike an Array, each object can only exist once, and checking for inclusion takes constant time.

Usage:¶ ↑

s = [1,3,2,3,4,3].to_ordered_set
s.to_a
# => [1,3,2,4]

t = OrderedSet.new([6,7,5,6,5])
t.to_a
# => [6,7,5]

(s + t).to_a
# => [1,3,2,4,6,7,5]

s << 5
s.to_a
# => [1,3,2,4,5]

s.delete(1)
s.to_a
# => [3,2,4,5]

Install:¶ ↑

sudo gem install ninjudd-deep_clonable -s http://gems.github.com
sudo gem install ninjudd-ordered_set -s http://gems.github.com

License:¶ ↑

Copyright © 2008 Justin Balthrop, Geni.com; Published under The MIT License, see LICENSE