field_mapper 0.3.10 → 0.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/field_mapper/standard/plat.rb +27 -0
- data/lib/field_mapper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 594d6e1015351ef81696eab1ce80313212559aef
|
4
|
+
data.tar.gz: 12b8c1966a7f79fd27e12ec6b6ed71ffb0876f2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 933897fa0a3a6d48af2ec7de7820dba8f33801d4cc0c01d42ebc6fbc3ff08f5264b48f482b0672b1b92199df75d0117bdb52c57179597d7a6173a7be1410890a
|
7
|
+
data.tar.gz: 9b69b2596b7e1edd9868a7bd8fe34d8f34204b4ca0b73e501840de9cd8bf183b24e1a9f240148f5c62b42a25f67917daec77f643b298ac80a42991090e23b3c6
|
@@ -67,6 +67,25 @@ module FieldMapper
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
+
def inspect
|
71
|
+
"#{name} #{new.snapshot.inspect}"
|
72
|
+
end
|
73
|
+
|
74
|
+
def symbolize_hash(hash)
|
75
|
+
hash.reduce({}) do |memo, pair|
|
76
|
+
key = pair.first.intern
|
77
|
+
value = pair.last
|
78
|
+
value = symbolize_hash(value) if value.is_a?(Hash)
|
79
|
+
if value.is_a?(Array)
|
80
|
+
value = value.map do |val|
|
81
|
+
val = symbolize_hash(val) if val.is_a?(Hash)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
memo[key] = value
|
85
|
+
memo
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
70
89
|
end
|
71
90
|
|
72
91
|
attr_reader :node_id
|
@@ -77,6 +96,10 @@ module FieldMapper
|
|
77
96
|
assign_params params
|
78
97
|
end
|
79
98
|
|
99
|
+
def inspect
|
100
|
+
"#<#{self.class.name}:0x00#{object_id.to_s(16)} #{snapshot.inspect}>"
|
101
|
+
end
|
102
|
+
|
80
103
|
def scope
|
81
104
|
@scope ||= begin
|
82
105
|
scope_name = self.class.name.split("::")[0..-2].join("::")
|
@@ -174,6 +197,10 @@ module FieldMapper
|
|
174
197
|
HashWithIndifferentAccess.new(hash)
|
175
198
|
end
|
176
199
|
|
200
|
+
def snapshot
|
201
|
+
self.class.symbolize_hash(to_hash(include_meta: false))
|
202
|
+
end
|
203
|
+
|
177
204
|
def cache_key
|
178
205
|
self.class.name + "-" + Digest::MD5.hexdigest(to_hash.to_s)
|
179
206
|
end
|
data/lib/field_mapper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: field_mapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hopkins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|