hashery 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8459bb831f3ff14d0b44ff30648c5c6e569de75d
4
+ data.tar.gz: 55fae7249dd499b25808e4a4e523f2c01057d55e
5
+ SHA512:
6
+ metadata.gz: 9b2fdfded7c965ef34498e94fd0a47bb2aad42255857c754d985bdcc5ebc4e8d440bf5b0faa9f9edd72918eb53bdfa319e5e22ab4f616ec15c20833e284a7775
7
+ data.tar.gz: c175b2f9590ae9c1e608c556132c3f574d12ac842548823786d8003f7a7d55b83a6845f5c74abc18bd3d620f51a04b595f1687af080952e3405ace2c7e42c73f
data/.index ADDED
@@ -0,0 +1,73 @@
1
+ ---
2
+ revision: 2013
3
+ type: ruby
4
+ sources:
5
+ - Index.yml
6
+ - Gemfile
7
+ authors:
8
+ - name: Trans
9
+ email: transfire@gmail.com
10
+ - name: Kirk Haines
11
+ - name: Robert Klemme
12
+ - name: Jan Molic
13
+ - name: George Moschovitis
14
+ - name: Jeena Paradies
15
+ - name: Erik Veenstra
16
+ organizations:
17
+ - name: RubyWorks (http://rubyworks.github.com/)
18
+ requirements:
19
+ - groups:
20
+ - development
21
+ - test
22
+ version: '>= 0'
23
+ name: qed
24
+ - groups:
25
+ - development
26
+ - test
27
+ version: '>= 0'
28
+ name: lemon
29
+ conflicts: []
30
+ alternatives: []
31
+ resources:
32
+ - type: home
33
+ uri: http://rubyworks.github.com/hashery
34
+ label: Homepage
35
+ - type: code
36
+ uri: http://github.com/rubyworks/hashery
37
+ label: Source Code
38
+ - type: mail
39
+ uri: http://groups.google.com/group/rubyworks-mailinglist
40
+ label: Mailing List
41
+ - type: docs
42
+ uri: http://rubydoc.info/github/rubyworks/hashery/master/frames
43
+ label: Documentation
44
+ - type: wiki
45
+ uri: http://wiki.github.com/rubyworks/hashery
46
+ label: User Guide
47
+ - type: gems
48
+ uri: http://rubygems.org/gems/hashery
49
+ repositories:
50
+ - name: upstream
51
+ scm: git
52
+ uri: git://github.com/rubyworks/hashery.git
53
+ categories: []
54
+ copyrights:
55
+ - holder: Rubyworks
56
+ year: '2010'
57
+ license: BSD-2-Clause
58
+ customs: []
59
+ paths:
60
+ lib:
61
+ - lib
62
+ - alt
63
+ name: hashery
64
+ title: Hashery
65
+ version: 2.1.1
66
+ summary: Facets-bread collection of Hash-like classes.
67
+ description: The Hashery is a tight collection of Hash-like classes. Included among
68
+ its many offerings are the auto-sorting Dictionary class, the efficient LRUHash,
69
+ the flexible OpenHash and the convenient KeyHash. Nearly every class is a subclass
70
+ of the CRUDHash which defines a CRUD model on top of Ruby's standard Hash making
71
+ it a snap to subclass and augment to fit any specific use case.
72
+ created: '2010-04-21'
73
+ date: '2013-08-21'
@@ -1,9 +1,22 @@
1
- = RELEASE HISTORY
1
+ # RELEASE HISTORY
2
2
 
3
- == 2.1.0 / 2012-11-24
3
+ ## 2.1.1 / 2013-08-21
4
+
5
+ This minor release clarifies the licensing. The entire library is now
6
+ distributed under the BSD-2-Clause license, also known as the FreeBSD
7
+ license. In addition this release provides a bug fix for flattening
8
+ arrays that contain an OpenCascade object.
9
+
10
+ Changes:
11
+
12
+ * Clarify licensing.
13
+ * Fix #flatten on Arrays that contain an OpenCascade.
14
+
15
+
16
+ ## 2.1.0 / 2012-11-24 (Golden Retriever)
4
17
 
5
18
  The major change of the 2.1 release is to switch over to `Hash#fetch`
6
- as the fundamental CRUD read method inplace of the previous `#read` core
19
+ as the fundamental CRUD read method in-place of the previous `#read` core
7
20
  extension (an alias of `#[]`). This is a pretty fundamental change which
8
21
  required modification of a number of classes. So please do extra-diligence
9
22
  and file an issue if you experience any problems.
@@ -23,7 +36,7 @@ Changes:
23
36
  * Change OpenCascade to auto-create the subclass when inherited.
24
37
 
25
38
 
26
- == 2.0.1 / 2012-07-06
39
+ ## 2.0.1 / 2012-07-06
27
40
 
28
41
  This minor release fixes an issue with OpenCascade (#13).
29
42
  The key_proc procedure wasn't being passed along to sub-cascades.
@@ -33,7 +46,7 @@ Changes:
33
46
  * OpenCascade passes along key_proc to children.
34
47
 
35
48
 
36
- == 2.0.0 / 2012-05-11
49
+ ## 2.0.0 / 2012-05-11 (Crud Space)
37
50
 
38
51
  This is a big release for Hashery which both culls some of it's
39
52
  less fitting classes and modules while greatly improving the rest.
@@ -56,7 +69,7 @@ Changes:
56
69
  * Removed open_object.rb, which has long been deprecated.
57
70
 
58
71
 
59
- == 1.5.1 / 2012-05-09
72
+ ## 1.5.1 / 2012-05-09
60
73
 
61
74
  This release adds transformative #each method to OpenCascade, to
62
75
  ensure #each returns an OpenCascade. Also, BasicCascade has been
@@ -70,7 +83,7 @@ Changes:
70
83
  * Renamed `Ini` class to `IniHash` class.
71
84
 
72
85
 
73
- == 1.5.0 / 2011-11-10
86
+ ## 1.5.0 / 2011-11-10 (Devil's Core)
74
87
 
75
88
  In this release, CoreExt module has been added to encapsulate
76
89
  methods that extend Ruby's core Hash class (there are only a few).
@@ -88,7 +101,7 @@ Changes:
88
101
  * Switch license to BSD-2-Clause license.
89
102
 
90
103
 
91
- == 1.4.0 / 2011-01-19
104
+ ## 1.4.0 / 2011-01-19 (Back To Basics)
92
105
 
93
106
  This release includes a copy of Ruby Facets' BasicObject class, which
94
107
  fixes the loading bug of the previous version. This release also renames
@@ -101,7 +114,7 @@ Changes:
101
114
  * Fix basicobject.rb loading issue.
102
115
 
103
116
 
104
- == 1.3.0 / 2010-10-01
117
+ ## 1.3.0 / 2010-10-01 (Private Property)
105
118
 
106
119
  This release fixes a minor bug in CastingHash and adds a new
107
120
  PropertyHash class.
@@ -117,7 +130,7 @@ Changes:
117
130
  * Fixed CastingHash#new where #to_proc is called against NilClass
118
131
 
119
132
 
120
- == 1.2.0 / 2010-06-04
133
+ ## 1.2.0 / 2010-06-04 (Fuzzy Wuzzy)
121
134
 
122
135
  This release makes two significant changes to the Hashery.
123
136
  First, we have a new shiny library called FuzzyHash by
@@ -138,7 +151,7 @@ Changes:
138
151
  * OpenCascade subclasses OpenHash and handles Array cascading.
139
152
 
140
153
 
141
- == 1.1.0 / 2010-04-28
154
+ ## 1.1.0 / 2010-04-28 (Ugly Ducklings)
142
155
 
143
156
  A follow-up release of Hashery that adds two new libraries:
144
157
  Association and SparseArray. Both of these may seem like odd
@@ -157,7 +170,7 @@ Changes:
157
170
  * Added sparsearray.rb
158
171
 
159
172
 
160
- == 1.0.0 / 2010-04-21
173
+ ## 1.0.0 / 2010-04-21 (Hatching Hashery)
161
174
 
162
175
  This is the first release of the Facets Hashery.
163
176
  Most of included classes come directly from Ruby
@@ -1,26 +1,23 @@
1
- Hashery
1
+ BSD-2-Clause License
2
2
 
3
- Copyright (c) 2009 Rubyworks
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are met:
4
5
 
5
- MIT License
6
+ 1. Redistributions of source code must retain the above copyright notice,
7
+ this list of conditions and the following disclaimer.
6
8
 
7
- Permission is hereby granted, free of charge, to any person obtaining a copy of
8
- this software and associated documentation files (the "Software"), to deal in
9
- the Software without restriction, including without limitation the rights to use,
10
- copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
11
- Software, and to permit persons to whom the Software is furnished to do so,
12
- subject to the following conditions:
9
+ 2. Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
13
12
 
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
-
24
- Website: http://rubyworks.github.com/hashery
25
- License: http://www.spdx.org/licenses/MIT
13
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
14
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
16
+ COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
17
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
20
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
22
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
23
 
data/NOTICE.txt CHANGED
@@ -2,12 +2,6 @@ All copyright holders have released their wares with a compatible
2
2
  license or have given permission for their work to be distributed
3
3
  under the same license as Hashery.
4
4
 
5
- BasicObject is based on Jim Weirich's BlankSlate class.
6
-
7
- BlankSlate
8
- Copyright 2004 by Jim Weirich (jim@weirichhouse.org).
9
- All rights reserved.
10
-
11
5
  Dictionary is based on OrderedHash by Jan Molic.
12
6
 
13
7
  OrderHash 2.0 Copyright (c) 2005 Jan Molic.
@@ -44,3 +38,9 @@ PathHash is based on SlashedHash by Daniel Parker
44
38
  Copyright (c) 2006 BehindLogic
45
39
  http://hash_magic.rubyforge.org
46
40
 
41
+ BasicObject is based on Jim Weirich's BlankSlate class.
42
+
43
+ BlankSlate
44
+ Copyright 2004 by Jim Weirich (jim@weirichhouse.org).
45
+ All rights reserved.
46
+
@@ -1,15 +1,17 @@
1
- = Hashery
1
+ # Hashery
2
2
 
3
- {Homepage}[http://rubyworks.github.com/hashery] |
4
- {Development}[http://github.com/rubyworks/hashery] |
5
- {Report Issue}[http://github.com/rubyworks/hashery/issues] |
6
- {Mailing List}[http://googlegroups.com/group.rubyworks-mailinglist] |
7
- {IRC}[irc://irc.freenode.net/rubyworks]
3
+ [Homepage](http://rubyworks.github.com/hashery) ·
4
+ [Development](http://github.com/rubyworks/hashery) ·
5
+ [Report Issue](http://github.com/rubyworks/hashery/issues] ·
6
+ [Mailing List](http://googlegroups.com/group.rubyworks-mailinglist] ·
7
+ [IRC](irc://irc.freenode.net/rubyworks)
8
8
 
9
- {<img src="http://travis-ci.org/rubyworks/hashery.png" />}[http://travis-ci.org/rubyworks/hashery]
9
+ [![Gem Version](https://badge.fury.io/rb/hashery.png)](http://badge.fury.io/rb/hashery)
10
+ [![Build Status](https://secure.travis-ci.org/rubyworks/hashery.png)](http://travis-ci.org/rubyworks/hashery) &nbsp; &nbsp;
11
+ [![Flattr Me](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/324911/Rubyworks-Ruby-Development-Fund)
10
12
 
11
13
 
12
- == DESCRIPTION
14
+ ## Description
13
15
 
14
16
  Among Ruby Facets most common additions were an assortment
15
17
  of Hash-like classes. To better support this collection
@@ -23,14 +25,14 @@ some variations of the standard Hash class and a few
23
25
  other yummy morsels.
24
26
 
25
27
 
26
- == HOW TO USE
28
+ ## Usage
27
29
 
28
- For usage information, see the individual library files included
29
- in this collection and read the demo documents which give
30
+ For instruction on usage, please see the individual library files
31
+ included in this collection and read the demo documents which give
30
32
  examples of almost all features.
31
33
 
32
34
 
33
- == CORE EXTENSIONS
35
+ ## Core Extensions
34
36
 
35
37
  Hashery adds four core extensions of Ruby's Hash class: `#retrieve`,
36
38
  `#rekey`, `#rekey!` and `Hash.create`. The first is simply an alias
@@ -40,17 +42,17 @@ a new hash with another hash upon initialization. All of these are
40
42
  sorely missing for Ruby itself, which is why they are provided here.
41
43
 
42
44
 
43
- == HOW TO INSTALL
45
+ ## Installation
44
46
 
45
47
  To install with RubyGems simply open a console and type:
46
48
 
47
49
  $ sudo gem install hashery
48
50
 
49
51
  Tarball packages are available for manual site installations
50
- via {Ruby Setup}[http://proutils.github.com/setup].
52
+ via [Ruby Setup](http://proutils.github.com/setup).
51
53
 
52
54
 
53
- == AUTHORS
55
+ ## Authors
54
56
 
55
57
  Developers who have contributed code to the project include:
56
58
 
@@ -63,15 +65,15 @@ Developers who have contributed code to the project include:
63
65
  * Erik Veenstra
64
66
 
65
67
 
66
- == CONTRIBUTE
68
+ ## Contributing
67
69
 
68
70
  Don't be a lump on a log. See an issue? Have a suggestion? Want to help?
69
71
  Well git in there!
70
72
 
71
- === Testing
73
+ ### Testing
72
74
 
73
- Hashery uses QED[http://rubyworks.github.com/qed] and
74
- Lemon[http://rubyworks.github.com/lemon] test frameworks.
75
+ Hashery uses [QED](http://rubyworks.github.com/qed) and
76
+ [Lemon](http://rubyworks.github.com/lemon) test frameworks.
75
77
  The QED framework to create well tested high-level documentation.
76
78
  Run the QED specs via:
77
79
 
@@ -83,34 +85,29 @@ RubyTest universal test harness.
83
85
  $ rubytest -Ilib test/
84
86
 
85
87
 
86
- === Patches
88
+ ### Patches
87
89
 
88
- Hashery's repository is hosted on GitHub[http://github.com/rubyworks/hashery].
90
+ Hashery's repository is hosted on [GitHub](http://github.com/rubyworks/hashery).
89
91
  If you'd like to offer up a fix or feature, fork the repo and submit a pull
90
92
  request (preferably in a topic branch). I assume you have heard
91
- all the talk about proper {practices}[http://learn.github.com/p/intro.html],
93
+ all the talk about proper [practices](http://learn.github.com/p/intro.html),
92
94
  so I won't bug you with it yet again.
93
95
 
94
- === Donations
96
+ ### Donations
95
97
 
96
98
  Yes, we FOSS programmers need to eat too! ;-) No seriously, any help you can
97
99
  offer goes a long way toward continued development of Rubyworks projects,
98
100
  including Hashery. See the upper right-hand corner on the
99
- Rubyworks[http://rubyworks.github.com] homepage. Thanks.
101
+ [Rubyworks](http://rubyworks.github.com) homepage. Thanks.
100
102
 
101
103
 
102
- == RELEASE NOTES
103
-
104
- Please see the HISTORY file.
105
-
106
-
107
- == COPYRIGHTS
104
+ ## Copyrights
108
105
 
109
106
  Copyright (c) 2010 Rubyworks
110
107
 
111
- Licensed under the *BSD-2-clause* license.
108
+ Licensed under the *BSD-2-Clause* license.
112
109
 
113
- See COPYING.rdoc file for further details.
110
+ See COPYING.md file for further details.
114
111
 
115
112
  Some libraries included in the Hashery have special copyrights
116
113
  attributing specific authors. Please see each library script for
@@ -0,0 +1,6 @@
1
+ = Hashery
2
+
3
+ For the following demos the `hashery` script has
4
+ been preloaded and the Hashery namespace has been
5
+ included into the demo context for convenience.
6
+
@@ -0,0 +1,63 @@
1
+ = OpenHash
2
+
3
+ An OpenHash is a Hash that provides +open+ access to its entries via method
4
+ calls. Writers (methods ending in =-marks) assign entries. Methods without
5
+ special puncuation will retrieve entries.
6
+
7
+ o = OpenHash.new
8
+ o.a = 1
9
+ o.b = 2
10
+ o.a.assert == 1
11
+ o.b.assert == 2
12
+
13
+ Writers always use a Symbol for keys in the underlying Hash.
14
+
15
+ o.to_h.assert == { :a=>1, :b=>2 }
16
+
17
+ All the usual Hash methods are still available in an OpenHash.
18
+
19
+ c = o.map{ |k,v| [k,v] }
20
+ c.assert.include?([:a,1])
21
+ c.assert.include?([:b,2])
22
+
23
+ And they are protected from being overridden by writers.
24
+
25
+ o.map = 3
26
+ o.map.refute == 3
27
+
28
+ Even so, the underlying Hash object does contain the entry even
29
+ when it cannot be accessed via a reader method.
30
+
31
+ o.to_h.assert == { :a=>1, :b=>2, :map=>3 }
32
+
33
+ We can see if a method is open or not via the `#open?` method.
34
+
35
+ o.open?(:a).assert == true
36
+ o.open?(:map).assert == false
37
+
38
+ For some usecases it may be necessary to give up access to one or
39
+ more Hash methods in favor of access to the hash entries. This can
40
+ be done using the `#open!` method.
41
+
42
+ o.open!(:map, :merge)
43
+ o.map.assert == 3
44
+ o.merge = 4
45
+ o.merge.assert == 4
46
+
47
+ Becuase of nature of a writer, a certain set of Hash methods are always
48
+ protected, in particluar all methods buffered by underscore (e.g. `__id__`).
49
+ So these cannot be opened.
50
+
51
+ expect ArgumentError do
52
+ o.open!(:__id__)
53
+ end
54
+
55
+ Even though writers alwasy use Symbols as keys, because an OpenHash
56
+ is a true Hash object, any object can be used as a key internally.
57
+
58
+ o = OpenHash.new
59
+ o[nil] = "Nothing"
60
+ o.to_h.assert == { nil=>"Nothing" }
61
+
62
+ It simply cannot be accessible via a reader method.
63
+