hashugar 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -3
- data/lib/hashugar/version.rb +1 -1
- data/lib/hashugar.rb +7 -0
- data/spec/hashugar_spec.rb +8 -0
- metadata +45 -74
data/README.md
CHANGED
@@ -11,10 +11,10 @@ Usage
|
|
11
11
|
|
12
12
|
-----
|
13
13
|
```ruby
|
14
|
-
hashugar = {:a => 1, 'b' => {:c => 3}}.to_hashugar
|
14
|
+
hashugar = {:a => 1, 'b' => {:c => 2, :d => [3, 4, {:e => 5}]}}.to_hashugar
|
15
15
|
hashugar.a # => 1
|
16
|
-
hashugar.b # => 2
|
17
|
-
hashugar.b.
|
16
|
+
hashugar.b.c # => 2
|
17
|
+
hashugar.b.d.last.e # => 5
|
18
18
|
```
|
19
19
|
|
20
20
|
How fast is it?
|
data/lib/hashugar/version.rb
CHANGED
data/lib/hashugar.rb
CHANGED
data/spec/hashugar_spec.rb
CHANGED
@@ -49,4 +49,12 @@ describe Hashugar do
|
|
49
49
|
hashugar.a.b.should == 1
|
50
50
|
end
|
51
51
|
end
|
52
|
+
|
53
|
+
context 'when accessing hashes in array' do
|
54
|
+
it 'should return hashugars' do
|
55
|
+
hashugar = [{:a => 1}, {:b => 2}].to_hashugar
|
56
|
+
hashugar[0].a.should == 1
|
57
|
+
hashugar.last.b.should == 2
|
58
|
+
end
|
59
|
+
end
|
52
60
|
end
|
metadata
CHANGED
@@ -1,75 +1,56 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashugar
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 0.0.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Jan Suchal
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-12-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: rspec
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70199714654940 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
33
22
|
type: :development
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: benchmark_suite
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: *70199714654940
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: benchmark_suite
|
27
|
+
requirement: &70199714654440 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
47
33
|
type: :development
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: ffi
|
51
34
|
prerelease: false
|
52
|
-
|
35
|
+
version_requirements: *70199714654440
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: ffi
|
38
|
+
requirement: &70199714653920 !ruby/object:Gem::Requirement
|
53
39
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
61
44
|
type: :development
|
62
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70199714653920
|
63
47
|
description: Nested OpenStruct optimized for short-lived objects.
|
64
|
-
email:
|
48
|
+
email:
|
65
49
|
- johno@jsmf.net
|
66
50
|
executables: []
|
67
|
-
|
68
51
|
extensions: []
|
69
|
-
|
70
52
|
extra_rdoc_files: []
|
71
|
-
|
72
|
-
files:
|
53
|
+
files:
|
73
54
|
- .gitignore
|
74
55
|
- .rvmrc
|
75
56
|
- Gemfile
|
@@ -81,40 +62,30 @@ files:
|
|
81
62
|
- lib/hashugar/version.rb
|
82
63
|
- spec/hashugar_spec.rb
|
83
64
|
- spec/spec_helper.rb
|
84
|
-
has_rdoc: true
|
85
65
|
homepage: http://github.com/jsuchal/hashugar
|
86
66
|
licenses: []
|
87
|
-
|
88
67
|
post_install_message:
|
89
68
|
rdoc_options: []
|
90
|
-
|
91
|
-
require_paths:
|
69
|
+
require_paths:
|
92
70
|
- lib
|
93
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
72
|
none: false
|
95
|
-
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
|
99
|
-
|
100
|
-
- 0
|
101
|
-
version: "0"
|
102
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
78
|
none: false
|
104
|
-
requirements:
|
105
|
-
- -
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
|
108
|
-
segments:
|
109
|
-
- 0
|
110
|
-
version: "0"
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
111
83
|
requirements: []
|
112
|
-
|
113
84
|
rubyforge_project:
|
114
|
-
rubygems_version: 1.
|
85
|
+
rubygems_version: 1.8.10
|
115
86
|
signing_key:
|
116
87
|
specification_version: 3
|
117
88
|
summary: Fast Nested OpenStruct
|
118
|
-
test_files:
|
89
|
+
test_files:
|
119
90
|
- spec/hashugar_spec.rb
|
120
91
|
- spec/spec_helper.rb
|