hash-proxy 0.1.3 → 0.1.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/.gitignore +2 -0
- data/History.txt +3 -0
- data/lib/hash_proxy/proxy.rb +12 -1
- data/version.txt +1 -1
- metadata +2 -2
data/.gitignore
CHANGED
data/History.txt
CHANGED
data/lib/hash_proxy/proxy.rb
CHANGED
@@ -12,6 +12,17 @@ module HashProxy
|
|
12
12
|
# Used to check if a setter is being called
|
13
13
|
EQUALS = '='.freeze
|
14
14
|
|
15
|
+
# Serialization
|
16
|
+
def marshal_dump
|
17
|
+
[@hash, @converted]
|
18
|
+
end
|
19
|
+
|
20
|
+
# Deserialization
|
21
|
+
def marshal_load(array)
|
22
|
+
@hash = array[0]
|
23
|
+
@converted = array[1]
|
24
|
+
end
|
25
|
+
|
15
26
|
# Create a hashProxy::Proxy object from the provided Hash.
|
16
27
|
#
|
17
28
|
# @param [Hash] hash The hash we are proxying
|
@@ -103,7 +114,7 @@ module HashProxy
|
|
103
114
|
def respond_to?(method)
|
104
115
|
method_name = method.to_s
|
105
116
|
method_name.gsub(/=$/, '')
|
106
|
-
(@hash.keys.map(&:to_s) + @converted.keys.map(&:to_s)).include?(method_name) || super
|
117
|
+
(@hash && @converted && (@hash.keys.map(&:to_s) + @converted.keys.map(&:to_s)).include?(method_name)) || super
|
107
118
|
end
|
108
119
|
|
109
120
|
# Converts an arbitrary object as follows:
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bones
|