angry_hash 0.3.3 → 0.3.4
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 +6 -17
- data/examples/leaky.rb +44 -0
- data/lib/angry_hash.rb +8 -0
- metadata +7 -7
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.4
|
data/angry_hash.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
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.4"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
-
s.authors = [
|
|
12
|
-
s.date = %q{2011-
|
|
11
|
+
s.authors = [%q{Lachie Cox}]
|
|
12
|
+
s.date = %q{2011-10-13}
|
|
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 = [
|
|
@@ -37,21 +37,10 @@ Gem::Specification.new do |s|
|
|
|
37
37
|
"lib/angry_hash/parsing/dot_notation.rb"
|
|
38
38
|
]
|
|
39
39
|
s.homepage = %q{http://github.com/plus2/angry_hash}
|
|
40
|
-
s.require_paths = [
|
|
41
|
-
s.rubygems_version = %q{1.
|
|
40
|
+
s.require_paths = [%q{lib}]
|
|
41
|
+
s.rubygems_version = %q{1.8.5}
|
|
42
42
|
s.summary = %q{A stabler mash with different emphases.}
|
|
43
|
-
s.test_files = [
|
|
44
|
-
"examples/accessors_eg.rb",
|
|
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"
|
|
54
|
-
]
|
|
43
|
+
s.test_files = [%q{examples/accessors_eg.rb}, %q{examples/creation_eg.rb}, %q{examples/dot_parser.eg.rb}, %q{examples/dsl.eg.rb}, %q{examples/dup_eg.rb}, %q{examples/eg_helper.rb}, %q{examples/extension_tracking.eg.rb}, %q{examples/leaky.rb}, %q{examples/merge_eg.rb}, %q{examples/merge_string_eg.rb}, %q{examples/normal_hash.eg.rb}]
|
|
55
44
|
|
|
56
45
|
if s.respond_to? :specification_version then
|
|
57
46
|
s.specification_version = 3
|
data/examples/leaky.rb
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
|
2
|
+
|
|
3
|
+
require 'angry_hash'
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'memprof'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
srand(12304123)
|
|
9
|
+
|
|
10
|
+
def mk_hash(a,depth=0)
|
|
11
|
+
if depth > 2
|
|
12
|
+
rand(100).to_s
|
|
13
|
+
else
|
|
14
|
+
5.times {
|
|
15
|
+
a[rand(100).to_s] = case rand(3)
|
|
16
|
+
when 0
|
|
17
|
+
rand(100).to_s
|
|
18
|
+
when 1
|
|
19
|
+
mk_hash({}, depth+1)
|
|
20
|
+
else
|
|
21
|
+
(0..(2+rand(5))).map { mk_hash({}, depth+1) }
|
|
22
|
+
end
|
|
23
|
+
}
|
|
24
|
+
a
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
Memprof.start
|
|
31
|
+
|
|
32
|
+
a = mk_hash({})
|
|
33
|
+
|
|
34
|
+
Memprof.stats
|
|
35
|
+
|
|
36
|
+
times = 1000
|
|
37
|
+
puts "=== duping #{times}"
|
|
38
|
+
times.times {
|
|
39
|
+
a = AngryHash[a]
|
|
40
|
+
GC.start
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
Memprof.stats
|
|
44
|
+
Memprof.stop
|
data/lib/angry_hash.rb
CHANGED
|
@@ -14,6 +14,10 @@ class AngryHash < Hash
|
|
|
14
14
|
|
|
15
15
|
extend AngryHash::Initialiser
|
|
16
16
|
|
|
17
|
+
module Utils
|
|
18
|
+
autoload :FromYaml, "angry_hash/utils/from_yaml"
|
|
19
|
+
end
|
|
20
|
+
|
|
17
21
|
|
|
18
22
|
alias_method :regular_writer, :[]= unless method_defined?(:regular_writer)
|
|
19
23
|
alias_method :regular_reader, :[] unless method_defined?(:regular_reader)
|
|
@@ -95,10 +99,14 @@ class AngryHash < Hash
|
|
|
95
99
|
hash
|
|
96
100
|
end
|
|
97
101
|
end
|
|
102
|
+
|
|
103
|
+
new_hash
|
|
98
104
|
when Array
|
|
99
105
|
new_array = cycle_guard[value.hash] = []
|
|
100
106
|
|
|
101
107
|
value.each {|v| new_array << __to_hash(v,keys,cycle_guard)}
|
|
108
|
+
|
|
109
|
+
new_array
|
|
102
110
|
else
|
|
103
111
|
value
|
|
104
112
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: angry_hash
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 27
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 3
|
|
9
|
-
-
|
|
10
|
-
version: 0.3.
|
|
9
|
+
- 4
|
|
10
|
+
version: 0.3.4
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Lachie Cox
|
|
@@ -15,8 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-
|
|
19
|
-
default_executable:
|
|
18
|
+
date: 2011-10-13 00:00:00 Z
|
|
20
19
|
dependencies: []
|
|
21
20
|
|
|
22
21
|
description: A stabler mash with different emphases. Used in plus2 projects AngryMob and Igor.
|
|
@@ -56,10 +55,10 @@ files:
|
|
|
56
55
|
- examples/dup_eg.rb
|
|
57
56
|
- examples/eg_helper.rb
|
|
58
57
|
- examples/extension_tracking.eg.rb
|
|
58
|
+
- examples/leaky.rb
|
|
59
59
|
- examples/merge_eg.rb
|
|
60
60
|
- examples/merge_string_eg.rb
|
|
61
61
|
- examples/normal_hash.eg.rb
|
|
62
|
-
has_rdoc: true
|
|
63
62
|
homepage: http://github.com/plus2/angry_hash
|
|
64
63
|
licenses: []
|
|
65
64
|
|
|
@@ -89,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
89
88
|
requirements: []
|
|
90
89
|
|
|
91
90
|
rubyforge_project:
|
|
92
|
-
rubygems_version: 1.
|
|
91
|
+
rubygems_version: 1.8.5
|
|
93
92
|
signing_key:
|
|
94
93
|
specification_version: 3
|
|
95
94
|
summary: A stabler mash with different emphases.
|
|
@@ -101,6 +100,7 @@ test_files:
|
|
|
101
100
|
- examples/dup_eg.rb
|
|
102
101
|
- examples/eg_helper.rb
|
|
103
102
|
- examples/extension_tracking.eg.rb
|
|
103
|
+
- examples/leaky.rb
|
|
104
104
|
- examples/merge_eg.rb
|
|
105
105
|
- examples/merge_string_eg.rb
|
|
106
106
|
- examples/normal_hash.eg.rb
|