store_model 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/store_model/types/array_type.rb +10 -2
- data/lib/store_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: af63b9a0cfb1ce85d4d2d81418cf102a9c32470cedce2191fb86b07970e1e73a
|
4
|
+
data.tar.gz: 9b109d3e56bbaad016f65b9c7db4ed3aa49091baae470546d94ebf1159bea081
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 485914961ef2a6c0d55705172d7f6251c1baf8802b5add498b4ce413f327926170748b008109fabae501b7c47a8293b131c79f95c90daa1ef39b59125ddbcd56
|
7
|
+
data.tar.gz: 3e66a2591f425a77789bb3eb45922d9dc6c5e3c07e6902df71a38a091f808c5904052196b9f21dd421cb5646e6751d5fea910b57e232b014c78c111c542014cf
|
@@ -69,15 +69,23 @@ module StoreModel
|
|
69
69
|
# rubocop:disable Style/RescueModifier
|
70
70
|
def decode_and_initialize(array_value)
|
71
71
|
decoded = ActiveSupport::JSON.decode(array_value) rescue []
|
72
|
-
decoded.map { |attributes|
|
72
|
+
decoded.map { |attributes| cast_model_type_value(attributes) }
|
73
73
|
end
|
74
74
|
# rubocop:enable Style/RescueModifier
|
75
75
|
|
76
76
|
def ensure_model_class(array)
|
77
77
|
array.map do |object|
|
78
|
-
object.is_a?(@model_klass) ? object :
|
78
|
+
object.is_a?(@model_klass) ? object : cast_model_type_value(object)
|
79
79
|
end
|
80
80
|
end
|
81
|
+
|
82
|
+
def cast_model_type_value(value)
|
83
|
+
model_klass_type.cast_value(value)
|
84
|
+
end
|
85
|
+
|
86
|
+
def model_klass_type
|
87
|
+
@model_klass_type ||= @model_klass.to_type
|
88
|
+
end
|
81
89
|
end
|
82
90
|
end
|
83
91
|
end
|
data/lib/store_model/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: store_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DmitryTsepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|