angry_hash 0.3.2 → 0.3.3
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/VERSION +1 -1
- data/angry_hash.gemspec +32 -30
- data/examples/dot_parser.eg.rb +9 -0
- data/examples/merge_string_eg.rb +8 -0
- data/lib/angry_hash/parsing/dot_notation.rb +28 -0
- data/lib/angry_hash/parsing.rb +6 -0
- data/lib/angry_hash.rb +3 -0
- metadata +26 -7
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.3
|
data/angry_hash.gemspec
CHANGED
|
@@ -1,60 +1,62 @@
|
|
|
1
1
|
# Generated by jeweler
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{angry_hash}
|
|
8
|
-
s.version = "0.3.
|
|
8
|
+
s.version = "0.3.3"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Lachie Cox"]
|
|
12
|
-
s.date = %q{
|
|
12
|
+
s.date = %q{2011-02-14}
|
|
13
13
|
s.description = %q{A stabler mash with different emphases. Used in plus2 projects AngryMob and Igor.}
|
|
14
14
|
s.email = %q{lachie@plus2.com.au}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
16
16
|
"LICENSE",
|
|
17
|
-
|
|
17
|
+
"README.md"
|
|
18
18
|
]
|
|
19
19
|
s.files = [
|
|
20
20
|
".gitignore",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
"Changelog.md",
|
|
22
|
+
"License",
|
|
23
|
+
"Rakefile",
|
|
24
|
+
"Readme.md",
|
|
25
|
+
"VERSION",
|
|
26
|
+
"angry_hash.gemspec",
|
|
27
|
+
"lib/angry_hash.rb",
|
|
28
|
+
"lib/angry_hash/conversion/by_reference.rb",
|
|
29
|
+
"lib/angry_hash/conversion/duplicating.rb",
|
|
30
|
+
"lib/angry_hash/dsl.rb",
|
|
31
|
+
"lib/angry_hash/extension.rb",
|
|
32
|
+
"lib/angry_hash/extension_aware.rb",
|
|
33
|
+
"lib/angry_hash/initialiser.rb",
|
|
34
|
+
"lib/angry_hash/merge_string.rb",
|
|
35
|
+
"lib/angry_hash/merging.rb",
|
|
36
|
+
"lib/angry_hash/parsing.rb",
|
|
37
|
+
"lib/angry_hash/parsing/dot_notation.rb"
|
|
36
38
|
]
|
|
37
39
|
s.homepage = %q{http://github.com/plus2/angry_hash}
|
|
38
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
|
39
40
|
s.require_paths = ["lib"]
|
|
40
|
-
s.rubygems_version = %q{1.
|
|
41
|
+
s.rubygems_version = %q{1.4.2}
|
|
41
42
|
s.summary = %q{A stabler mash with different emphases.}
|
|
42
43
|
s.test_files = [
|
|
43
44
|
"examples/accessors_eg.rb",
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
"examples/creation_eg.rb",
|
|
46
|
+
"examples/dot_parser.eg.rb",
|
|
47
|
+
"examples/dsl.eg.rb",
|
|
48
|
+
"examples/dup_eg.rb",
|
|
49
|
+
"examples/eg_helper.rb",
|
|
50
|
+
"examples/extension_tracking.eg.rb",
|
|
51
|
+
"examples/merge_eg.rb",
|
|
52
|
+
"examples/merge_string_eg.rb",
|
|
53
|
+
"examples/normal_hash.eg.rb"
|
|
51
54
|
]
|
|
52
55
|
|
|
53
56
|
if s.respond_to? :specification_version then
|
|
54
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
55
57
|
s.specification_version = 3
|
|
56
58
|
|
|
57
|
-
if Gem::Version.new(Gem::
|
|
59
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
58
60
|
else
|
|
59
61
|
end
|
|
60
62
|
else
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class AngryHash
|
|
2
|
+
module Parsing
|
|
3
|
+
module DotNotation
|
|
4
|
+
def add_dotted(dotted)
|
|
5
|
+
dotted.each do |key,value|
|
|
6
|
+
set_dotted(key.to_s,value)
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def set_dotted(key, value)
|
|
11
|
+
parts = key.split(".")
|
|
12
|
+
last = parts.pop
|
|
13
|
+
|
|
14
|
+
parent = __resolve_dotted(self, parts)
|
|
15
|
+
parent[last] = value
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def __resolve_dotted(parent, dotted)
|
|
19
|
+
return parent if dotted.empty?
|
|
20
|
+
|
|
21
|
+
dotted = dotted.dup
|
|
22
|
+
first = dotted.shift
|
|
23
|
+
new_child = parent.send("#{first}!")
|
|
24
|
+
__resolve_dotted(new_child, dotted)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/lib/angry_hash.rb
CHANGED
|
@@ -6,6 +6,8 @@ class AngryHash < Hash
|
|
|
6
6
|
require 'angry_hash/merging'
|
|
7
7
|
require 'angry_hash/initialiser'
|
|
8
8
|
|
|
9
|
+
require 'angry_hash/parsing'
|
|
10
|
+
|
|
9
11
|
# config
|
|
10
12
|
require 'angry_hash/dsl'
|
|
11
13
|
include AngryHash::DSL
|
|
@@ -141,4 +143,5 @@ class AngryHash < Hash
|
|
|
141
143
|
include Conversion::Duplicating
|
|
142
144
|
include Conversion::ByReference
|
|
143
145
|
include ExtensionAware
|
|
146
|
+
include Parsing
|
|
144
147
|
end
|
metadata
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: angry_hash
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
4
|
+
hash: 21
|
|
5
|
+
prerelease:
|
|
5
6
|
segments:
|
|
6
7
|
- 0
|
|
7
8
|
- 3
|
|
8
|
-
-
|
|
9
|
-
version: 0.3.
|
|
9
|
+
- 3
|
|
10
|
+
version: 0.3.3
|
|
10
11
|
platform: ruby
|
|
11
12
|
authors:
|
|
12
13
|
- Lachie Cox
|
|
@@ -14,7 +15,7 @@ autorequire:
|
|
|
14
15
|
bindir: bin
|
|
15
16
|
cert_chain: []
|
|
16
17
|
|
|
17
|
-
date:
|
|
18
|
+
date: 2011-02-14 00:00:00 +11:00
|
|
18
19
|
default_executable:
|
|
19
20
|
dependencies: []
|
|
20
21
|
|
|
@@ -44,44 +45,62 @@ files:
|
|
|
44
45
|
- lib/angry_hash/initialiser.rb
|
|
45
46
|
- lib/angry_hash/merge_string.rb
|
|
46
47
|
- lib/angry_hash/merging.rb
|
|
48
|
+
- lib/angry_hash/parsing.rb
|
|
49
|
+
- lib/angry_hash/parsing/dot_notation.rb
|
|
47
50
|
- LICENSE
|
|
48
51
|
- README.md
|
|
52
|
+
- examples/accessors_eg.rb
|
|
53
|
+
- examples/creation_eg.rb
|
|
54
|
+
- examples/dot_parser.eg.rb
|
|
55
|
+
- examples/dsl.eg.rb
|
|
56
|
+
- examples/dup_eg.rb
|
|
57
|
+
- examples/eg_helper.rb
|
|
58
|
+
- examples/extension_tracking.eg.rb
|
|
59
|
+
- examples/merge_eg.rb
|
|
60
|
+
- examples/merge_string_eg.rb
|
|
61
|
+
- examples/normal_hash.eg.rb
|
|
49
62
|
has_rdoc: true
|
|
50
63
|
homepage: http://github.com/plus2/angry_hash
|
|
51
64
|
licenses: []
|
|
52
65
|
|
|
53
66
|
post_install_message:
|
|
54
|
-
rdoc_options:
|
|
55
|
-
|
|
67
|
+
rdoc_options: []
|
|
68
|
+
|
|
56
69
|
require_paths:
|
|
57
70
|
- lib
|
|
58
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
|
+
none: false
|
|
59
73
|
requirements:
|
|
60
74
|
- - ">="
|
|
61
75
|
- !ruby/object:Gem::Version
|
|
76
|
+
hash: 3
|
|
62
77
|
segments:
|
|
63
78
|
- 0
|
|
64
79
|
version: "0"
|
|
65
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
|
+
none: false
|
|
66
82
|
requirements:
|
|
67
83
|
- - ">="
|
|
68
84
|
- !ruby/object:Gem::Version
|
|
85
|
+
hash: 3
|
|
69
86
|
segments:
|
|
70
87
|
- 0
|
|
71
88
|
version: "0"
|
|
72
89
|
requirements: []
|
|
73
90
|
|
|
74
91
|
rubyforge_project:
|
|
75
|
-
rubygems_version: 1.
|
|
92
|
+
rubygems_version: 1.4.2
|
|
76
93
|
signing_key:
|
|
77
94
|
specification_version: 3
|
|
78
95
|
summary: A stabler mash with different emphases.
|
|
79
96
|
test_files:
|
|
80
97
|
- examples/accessors_eg.rb
|
|
81
98
|
- examples/creation_eg.rb
|
|
99
|
+
- examples/dot_parser.eg.rb
|
|
82
100
|
- examples/dsl.eg.rb
|
|
83
101
|
- examples/dup_eg.rb
|
|
84
102
|
- examples/eg_helper.rb
|
|
85
103
|
- examples/extension_tracking.eg.rb
|
|
86
104
|
- examples/merge_eg.rb
|
|
105
|
+
- examples/merge_string_eg.rb
|
|
87
106
|
- examples/normal_hash.eg.rb
|