hashpipe 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/hashpipe.rb +5 -3
- data/test/test_hashpipe_superopenstruct.rb +8 -0
- metadata +12 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/lib/hashpipe.rb
CHANGED
@@ -57,12 +57,12 @@ class HashPipe
|
|
57
57
|
include Enumerable
|
58
58
|
|
59
59
|
def [](sym_or_str)
|
60
|
-
self.__class__.create_accessor(sym_or_str, self)
|
60
|
+
self.__class__.create_accessor(sym_or_str, self) if self.__respond_to?(:method_missing)
|
61
61
|
self.__send__(sym_or_str)
|
62
62
|
end
|
63
63
|
|
64
64
|
def []=(sym_or_str, value)
|
65
|
-
self.__class__.create_accessor(sym_or_str, self)
|
65
|
+
self.__class__.create_accessor(sym_or_str, self) if self.__respond_to?(:method_missing)
|
66
66
|
self.__send__(:"#{sym_or_str}=", value)
|
67
67
|
end
|
68
68
|
|
@@ -94,6 +94,8 @@ class HashPipe
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def lock!
|
97
|
-
|
97
|
+
if __respond_to?(:method_missing)
|
98
|
+
class << self; undef_method :method_missing; end
|
99
|
+
end
|
98
100
|
end
|
99
101
|
end
|
@@ -33,6 +33,14 @@ class TestHashpipeSuperOpenStruct < Test::Unit::TestCase
|
|
33
33
|
h.bar = "baz"
|
34
34
|
end
|
35
35
|
|
36
|
+
assert_raises(NoMethodError) do
|
37
|
+
h[:bar] = "baz"
|
38
|
+
end
|
39
|
+
|
40
|
+
assert_raises(NoMethodError) do
|
41
|
+
h['bar'] = "baz"
|
42
|
+
end
|
43
|
+
|
36
44
|
assert_equal(h.foo, "bar")
|
37
45
|
assert_equal(h[:foo], "bar")
|
38
46
|
assert_equal(h['foo'], "bar")
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashpipe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Erik Hollensbe
|
@@ -21,9 +22,11 @@ dependencies:
|
|
21
22
|
name: test-unit
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -33,9 +36,11 @@ dependencies:
|
|
33
36
|
name: rdoc
|
34
37
|
prerelease: false
|
35
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
36
40
|
requirements:
|
37
41
|
- - ">="
|
38
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
39
44
|
segments:
|
40
45
|
- 0
|
41
46
|
version: "0"
|
@@ -70,23 +75,27 @@ rdoc_options:
|
|
70
75
|
require_paths:
|
71
76
|
- lib
|
72
77
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
73
79
|
requirements:
|
74
80
|
- - ">="
|
75
81
|
- !ruby/object:Gem::Version
|
82
|
+
hash: 3
|
76
83
|
segments:
|
77
84
|
- 0
|
78
85
|
version: "0"
|
79
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
80
88
|
requirements:
|
81
89
|
- - ">="
|
82
90
|
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
83
92
|
segments:
|
84
93
|
- 0
|
85
94
|
version: "0"
|
86
95
|
requirements: []
|
87
96
|
|
88
97
|
rubyforge_project:
|
89
|
-
rubygems_version: 1.3.
|
98
|
+
rubygems_version: 1.3.7
|
90
99
|
signing_key:
|
91
100
|
specification_version: 3
|
92
101
|
summary: Create openstructs that are also symbol and string structs!
|