isomorfeus-data 2.5.1 → 2.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91283398b281d30718eac57dd4f29e0ea2cbd36d2fd425ba4b0e9d7948169610
4
- data.tar.gz: 3a540b7f83b2c5e2018701b4a3cfaf8ec0804df2931df4a072aec4466b4e3f61
3
+ metadata.gz: 198fe12b353be42d725a63ccd4495052c19a20a24e1f4223c3a2d4ac9c39fe4a
4
+ data.tar.gz: bd01e302b472b1a1c847c5c49c5139edcb619faa48adfcdc3fd7e49996fcfaec
5
5
  SHA512:
6
- metadata.gz: de65f26e2a7e318cdbdd003bcaf0c86cd6d01155f6ecff83e531c18e9749b2499a63c9b2fa0824dcd226348feb66c89babb5ee3861d7729b986a559932882111
7
- data.tar.gz: 4dcf2ab70b4a091a0515a9fdab07c2ca658163621c52c9424568eec2627e4c0776d4c8d3a3595c46da79eb30a258e5872bde25be70fdfd010a5e7b7c34f7601b
6
+ metadata.gz: 410185c046e6c116eeca7e87fc84813f1961e23fc822f487714ab367f7e0f4f8e2e9090206138d0a0de43813420b8c9efa351aa099c8e2582e41f4ae35aa9216
7
+ data.tar.gz: 7daa859033b8d5dd50d0dded8e3bcf3c2447ee825f0450358060ccee86ba32b55ea5a7cddad3e963d268db24c1545da9e7d56b1adc5e0ddca207d75c78d5ffc6
@@ -64,9 +64,13 @@ module Isomorfeus
64
64
  field_types[obj_name] == :object
65
65
  end
66
66
 
67
+ def validate_field!(field_name, val)
68
+ raise "no such field" unless field?(field_name)
69
+ Isomorfeus::Props::Validator.new(self.name, field_name, val, field_conditions[field_name]).validate!
70
+ end
71
+
67
72
  def valid_field?(field_name, val)
68
- return Isomorfeus::Props::Validator.new(self.name, field_name, val, field_conditions[field_name]).validate! if field?(field_name)
69
- false
73
+ validate_field!(field_name, val)
70
74
  rescue
71
75
  false
72
76
  end
@@ -84,6 +88,7 @@ module Isomorfeus
84
88
  rescue
85
89
  false
86
90
  end
91
+ alias valid_embed? valid_attribute?
87
92
 
88
93
  def valid_object?(obj_name, val)
89
94
  return valid_field?(obj_name, val) if object?(obj_name)
@@ -91,6 +96,7 @@ module Isomorfeus
91
96
  rescue
92
97
  false
93
98
  end
99
+ alias valid_reference? valid_object?
94
100
 
95
101
  def validate
96
102
  Isomorfeus::Props::ValidateHashProxy.new
@@ -85,7 +85,7 @@ module Isomorfeus
85
85
 
86
86
  def save_object(key, fields, already_saved)
87
87
  id = get_object_id(key)
88
- raise "object not created yet" unless id
88
+ return create_object(key, fields, already_saved) unless id
89
89
  ft = @object_class.field_types
90
90
  hash = fields.to_h do |k, v|
91
91
  [k, serialize_or_save(v, ft[k], already_saved)]
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Data
3
- VERSION = '2.5.1'
3
+ VERSION = '2.5.4'
4
4
  end
5
5
  end
@@ -141,10 +141,19 @@ module LucidObject
141
141
  end
142
142
 
143
143
  def each(&block)
144
- self.object_accelerator.each do |fields|
145
- block.call self.new(key: fields.delete(:key), fields: fields)
144
+ if block_given?
145
+ self.object_accelerator.each do |fields|
146
+ block.call self.new(key: fields.delete(:key), fields: fields)
147
+ end
148
+ else
149
+ Enumerator.new do |yielder|
150
+ self.object_accelerator.each do |fields|
151
+ yielder << self.new(key: fields.delete(:key), fields: fields)
152
+ end
153
+ end
146
154
  end
147
155
  end
156
+ alias to_enum each
148
157
 
149
158
  def search(field = nil, val = nil, options = {}, query: nil)
150
159
  if field && !self.field_options[field]&.fetch(:index) == :yes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-30 00:00:00.000000000 Z
11
+ date: 2022-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -100,28 +100,28 @@ dependencies:
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 2.5.1
103
+ version: 2.5.4
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 2.5.1
110
+ version: 2.5.4
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: isomorfeus-policy
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 2.5.1
117
+ version: 2.5.4
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 2.5.1
124
+ version: 2.5.4
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: isomorfeus-preact
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -156,28 +156,28 @@ dependencies:
156
156
  requirements:
157
157
  - - '='
158
158
  - !ruby/object:Gem::Version
159
- version: 2.5.1
159
+ version: 2.5.4
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - '='
165
165
  - !ruby/object:Gem::Version
166
- version: 2.5.1
166
+ version: 2.5.4
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: isomorfeus
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: 2.5.1
173
+ version: 2.5.4
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - '='
179
179
  - !ruby/object:Gem::Version
180
- version: 2.5.1
180
+ version: 2.5.4
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rake
183
183
  requirement: !ruby/object:Gem::Requirement