protobuf-activerecord 3.0.0.rc2 → 3.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/protobuf/active_record/serialization.rb +14 -10
- data/lib/protobuf/active_record/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4138119bd9c5f0638a76a08f3a796ceda7f94163
|
4
|
+
data.tar.gz: 1659d777be06f6318e7a2a4b3ccf61ca8b1eeb52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e25a6022d48d954920499422fc197bde2bec941d7071f9d6c0fe56dc7072b1f398958b4e87fba60b41aa75eaed3aeaa7aa80ecd52265fdb3b5a69da3b26c804
|
7
|
+
data.tar.gz: 4c24f5639552493d4a645c3f2b751d62ecd53e0f085f5383df6116a2796ebac910e7acd130cab6b618eb300e7568572afdd0beef616926833070fcf172a1b9f3
|
@@ -1,5 +1,4 @@
|
|
1
1
|
'active_support/concerns'
|
2
|
-
'heredity'
|
3
2
|
|
4
3
|
module Protobuf
|
5
4
|
module ActiveRecord
|
@@ -7,14 +6,11 @@ module Protobuf
|
|
7
6
|
extend ::ActiveSupport::Concern
|
8
7
|
|
9
8
|
included do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
@_protobuf_field_transformers = {}
|
17
|
-
@_protobuf_field_options = {}
|
9
|
+
class << self
|
10
|
+
attr_writer :_protobuf_field_transformers,
|
11
|
+
:_protobuf_field_options,
|
12
|
+
:protobuf_message
|
13
|
+
end
|
18
14
|
|
19
15
|
private :_protobuf_convert_attributes_to_fields
|
20
16
|
private :_protobuf_field_transformers
|
@@ -42,6 +38,14 @@ module Protobuf
|
|
42
38
|
return value
|
43
39
|
end
|
44
40
|
|
41
|
+
def _protobuf_field_options
|
42
|
+
@_protobuf_field_options ||= {}
|
43
|
+
end
|
44
|
+
|
45
|
+
def _protobuf_field_transformers
|
46
|
+
@_protobuf_field_transformers ||= {}
|
47
|
+
end
|
48
|
+
|
45
49
|
# Define a field transformation from a record. Accepts a Symbol,
|
46
50
|
# callable, or block that is called with the record being serialized.
|
47
51
|
#
|
@@ -91,7 +95,7 @@ module Protobuf
|
|
91
95
|
#
|
92
96
|
def protobuf_fields(*fields)
|
93
97
|
options = fields.extract_options!
|
94
|
-
options[:only] = fields
|
98
|
+
options[:only] = fields if fields.present?
|
95
99
|
|
96
100
|
self._protobuf_field_options = options
|
97
101
|
end
|