xkeys 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.txt +5 -0
- data/lib/xkeys.rb +18 -4
- data/xkeys.gemspec +4 -3
- metadata +3 -4
- data/test/run_tests.sh +0 -8
data/HISTORY.txt
ADDED
data/lib/xkeys.rb
CHANGED
@@ -3,11 +3,25 @@
|
|
3
3
|
#
|
4
4
|
# Synopsis:
|
5
5
|
# root = {}.extend XKeys::Hash
|
6
|
+
# root[:my, :list, nil] = 'value 1'
|
7
|
+
# root[:my, :list, nil] = 'value 2'
|
8
|
+
# root[:sparse, 10] = 'value 3'
|
9
|
+
# # => { :my => { :list => [ 'value 1', 'value 2' ] },
|
10
|
+
# # :sparse => { 10 => 'value 3' } }
|
11
|
+
# root[:missing] # => nil
|
12
|
+
# root[:missing, :else => false] # => false
|
13
|
+
# root[:missing, {}] # => raises KeyError
|
14
|
+
#
|
6
15
|
# root = [].extend XKeys::Auto
|
16
|
+
# root[1, nil] = 'value 1'
|
17
|
+
# root[1, 3] = 'value 2'
|
18
|
+
# # => [ nil, [ 'value 1', nil, nil, 'value 2' ] ]
|
19
|
+
# root[0, 1] # => [ nil ] (slice of length 1 at 0)
|
20
|
+
# root[nil, 1, 0] # => 'value 1'
|
7
21
|
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
22
|
+
# @author Brian Katzung <briank@kappacs.com>, Kappa Computer Solutions, LLC
|
23
|
+
# @copyright 2013 Brian Katzung and Kappa Computer Solutions, LLC
|
24
|
+
# @license MIT License
|
11
25
|
|
12
26
|
module XKeys; end
|
13
27
|
|
@@ -114,7 +128,7 @@ module XKeys::Set_Auto
|
|
114
128
|
|
115
129
|
# Auto-vivify nested hash and/or array trees using extended hash
|
116
130
|
# key/array index assignment syntax. Nil keys and integer keys
|
117
|
-
#
|
131
|
+
# create nested arrays as needed. Other keys create nested hashes
|
118
132
|
# as needed.
|
119
133
|
#
|
120
134
|
# root[key1, ..., keyN] = value
|
data/xkeys.gemspec
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "xkeys"
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.2"
|
4
|
+
s.date = "2013-07-08"
|
4
5
|
s.authors = ["Brian Katzung"]
|
5
6
|
s.email = ["briank@kappacs.com"]
|
6
7
|
s.homepage = "http://rubygems.org/gems/xkeys"
|
@@ -8,7 +9,7 @@ Gem::Specification.new do |s|
|
|
8
9
|
s.description = "Extended keys to facilitate fetching and storing in nested hash and array structures with Perl-ish auto-vivification."
|
9
10
|
s.license = "MIT"
|
10
11
|
|
11
|
-
s.files = Dir.glob("lib/**/*") + %w{xkeys.gemspec}
|
12
|
-
s.test_files = Dir.glob("test
|
12
|
+
s.files = Dir.glob("lib/**/*") + %w{xkeys.gemspec HISTORY.txt}
|
13
|
+
s.test_files = Dir.glob("test/**/*.rb")
|
13
14
|
s.require_path = 'lib'
|
14
15
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Brian Katzung
|
@@ -30,9 +30,9 @@ extra_rdoc_files: []
|
|
30
30
|
files:
|
31
31
|
- lib/xkeys.rb
|
32
32
|
- xkeys.gemspec
|
33
|
+
- HISTORY.txt
|
33
34
|
- test/03auto.rb
|
34
35
|
- test/01get.rb
|
35
|
-
- test/run_tests.sh
|
36
36
|
- test/04mod_combos.rb
|
37
37
|
- test/02hash.rb
|
38
38
|
has_rdoc: true
|
@@ -70,6 +70,5 @@ summary: Extended keys to facilitate fetching and storing in nested hash and arr
|
|
70
70
|
test_files:
|
71
71
|
- test/03auto.rb
|
72
72
|
- test/01get.rb
|
73
|
-
- test/run_tests.sh
|
74
73
|
- test/04mod_combos.rb
|
75
74
|
- test/02hash.rb
|