field_masked_model 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/field_masked_model/attribute_converter.rb +15 -0
- data/lib/field_masked_model/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b78a602bb5b978858cdc84253a7dd046783af730f2874c833810bb1184a7d8aa
|
4
|
+
data.tar.gz: 9b016cdf07c046ea12a98cfaa83c7f38e1119f18d59f2b880dcd5a84e5ef54ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 265bc702e5ec99c1e48b59ca36c6c2d47f99a4c89ee86ce348dc66eabec73320172398ee4d856e4c11935967ce2350cef9e74a2872d07fae416a8655713191f5
|
7
|
+
data.tar.gz: aa0100dcfa178f18df044f4a6ce00b1d06706cf189bba2955858e34822eab4b886fe61b0a8d383d01968b87a4d6db5afd4939a1ebb4ca1e2a7a39c0926a68693
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
field_masked_model (0.
|
4
|
+
field_masked_model (0.3.0)
|
5
5
|
fmparser (= 0.1.0)
|
6
6
|
google-protobuf (~> 3.7)
|
7
7
|
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
coderay (1.1.2)
|
12
12
|
diff-lcs (1.3)
|
13
13
|
fmparser (0.1.0)
|
14
|
-
google-protobuf (3.
|
14
|
+
google-protobuf (3.9.0)
|
15
15
|
method_source (0.9.2)
|
16
16
|
pry (0.12.2)
|
17
17
|
coderay (~> 1.1.0)
|
@@ -1,12 +1,27 @@
|
|
1
1
|
require "google/protobuf/timestamp_pb"
|
2
|
+
require "google/protobuf/wrappers_pb"
|
2
3
|
|
3
4
|
module FieldMaskedModel
|
4
5
|
module AttributeConverter
|
6
|
+
NULLABLE_TYPES = [
|
7
|
+
Google::Protobuf::DoubleValue,
|
8
|
+
Google::Protobuf::FloatValue,
|
9
|
+
Google::Protobuf::Int64Value,
|
10
|
+
Google::Protobuf::UInt64Value,
|
11
|
+
Google::Protobuf::Int32Value,
|
12
|
+
Google::Protobuf::UInt32Value,
|
13
|
+
Google::Protobuf::BoolValue,
|
14
|
+
Google::Protobuf::StringValue,
|
15
|
+
Google::Protobuf::BytesValue,
|
16
|
+
].freeze
|
17
|
+
|
5
18
|
class << self
|
6
19
|
def convert(value)
|
7
20
|
case value
|
8
21
|
when Google::Protobuf::Timestamp
|
9
22
|
timestamp_to_time(value)
|
23
|
+
when *NULLABLE_TYPES
|
24
|
+
value.value
|
10
25
|
else
|
11
26
|
# TODO(south37) Add conversion logic of other classes
|
12
27
|
value
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: field_masked_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nao Minami
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|