datory 2.2.0.rc2 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1763a8028c249bf60dd2f07861f5eae4d74055fa3c54f194d945dc679a5d5dd9
4
- data.tar.gz: d98843e8292925b82c9a09f21354eec56e141a50fc6dbc0a152837c6f059a33b
3
+ metadata.gz: 73e07ca3ba99f0f55ab76b4fc53b2e0deaaae05957f6fc6ef55bef9d29f1f52e
4
+ data.tar.gz: 8e9549b871d64c15811f4c017f829fcc4ac46bc512a224747d8b50ebf11008c1
5
5
  SHA512:
6
- metadata.gz: 5250ce51ddf8946501529bd3dc1716d83f8c2f8ee36d564578e12d7a5fcee7ea6d9d3d1fb126e9d2f363e12ca84fc32434acf077c8c2e78aeeb5efa15a47af3a
7
- data.tar.gz: 458ab398ebabd8ce06a7b6ff031f81a39a00ceab611962279b23fcf5fe90a50e783293d53ec8f1807817099be2c4713e92738fadbb15350179f71d576a12d8e8
6
+ metadata.gz: b1f740b62a35e34fdf7a60b5c0875a808ce975e4d259c2c216f17ffb6d574fa8a087b5f1ea061f50bac633397e55f8a590a09ab412605890a9d06983b7769173
7
+ data.tar.gz: da5e06664b22cf5f22ed019d2b10a81077f9ff6cfa92d811cf2ee20c5a946267b779e921acbe1b996bb95fc3428add605145b47675591211c85528f371ef838c
@@ -7,7 +7,7 @@ module Datory
7
7
 
8
8
  def initialize(name, **options) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
9
9
  @from = Options::From.new(
10
- name: name,
10
+ name:,
11
11
  type: options.fetch(:from),
12
12
  consists_of: options.fetch(:consists_of, false),
13
13
  min: options.fetch(:min, nil),
@@ -31,7 +31,7 @@ module Datory
31
31
  rows << row
32
32
  end
33
33
 
34
- Datory::Console.print_table(title: service_class_name, headings: headings.uniq, rows: rows)
34
+ Datory::Console.print_table(title: service_class_name, headings: headings.uniq, rows:)
35
35
  end
36
36
  end
37
37
  end
@@ -28,7 +28,7 @@ module Datory
28
28
  name,
29
29
  to: to.presence || name,
30
30
  from: [include, Hash],
31
- include: include,
31
+ include:,
32
32
  as: [include, Hash]
33
33
  )
34
34
  end
@@ -40,7 +40,7 @@ module Datory
40
40
  name,
41
41
  to: to.presence || name,
42
42
  from: [include, Hash, NilClass],
43
- include: include,
43
+ include:,
44
44
  as: [include, Hash, NilClass],
45
45
  required: false
46
46
  )
@@ -52,7 +52,7 @@ module Datory
52
52
  to: to.presence || name,
53
53
  from: Array,
54
54
  consists_of: [include, Hash],
55
- include: include,
55
+ include:,
56
56
  as: Array
57
57
  )
58
58
  end
@@ -65,7 +65,7 @@ module Datory
65
65
  to: to.presence || name,
66
66
  from: Array,
67
67
  consists_of: [include, Hash],
68
- include: include,
68
+ include:,
69
69
  as: Array,
70
70
  required: false,
71
71
  default: []
@@ -17,12 +17,12 @@ module Datory
17
17
 
18
18
  def info
19
19
  {
20
- name: name,
21
- type: type,
22
- min: min,
23
- max: max,
24
- consists_of: consists_of,
25
- format: format
20
+ name:,
21
+ type:,
22
+ min:,
23
+ max:,
24
+ consists_of:,
25
+ format:
26
26
  }
27
27
  end
28
28
  end
@@ -7,7 +7,7 @@ module Datory
7
7
  def initialize(name:, type:, consists_of:, min:, max:, format:)
8
8
  format = format.fetch(:from, nil) if format.is_a?(Hash)
9
9
 
10
- super(name: name, type: type, consists_of: consists_of, min: min, max: max, format: format)
10
+ super
11
11
  end
12
12
  end
13
13
  end
@@ -13,13 +13,13 @@ module Datory
13
13
 
14
14
  format = format.fetch(:to, nil) if format.is_a?(Hash)
15
15
 
16
- super(name: name, type: type, consists_of: consists_of, min: min, max: max, format: format)
16
+ super(name:, type:, consists_of:, min:, max:, format:)
17
17
  end
18
18
 
19
19
  def info
20
20
  super.merge(
21
- required: required,
22
- default: default,
21
+ required:,
22
+ default:,
23
23
  include: include_class
24
24
  )
25
25
  end
@@ -5,7 +5,7 @@ module Datory
5
5
  module Serialization
6
6
  class Serializator
7
7
  def self.serialize(model:, collection_of_attributes:)
8
- new(collection_of_attributes: collection_of_attributes).serialize(model: model)
8
+ new(collection_of_attributes:).serialize(model:)
9
9
  end
10
10
 
11
11
  def initialize(collection_of_attributes:)
@@ -13,8 +13,8 @@ module Datory
13
13
  model = Serialization::ServiceBuilder.build!(self, model, collection_of_attributes)
14
14
 
15
15
  Serialization::Serializator.serialize(
16
- model: model,
17
- collection_of_attributes: collection_of_attributes
16
+ model:,
17
+ collection_of_attributes:
18
18
  )
19
19
  end
20
20
 
@@ -6,9 +6,9 @@ module Datory
6
6
  class Console
7
7
  def self.print_table(headings:, rows:, title: nil)
8
8
  table = Terminal::Table.new(
9
- title: title,
10
- headings: headings,
11
- rows: rows,
9
+ title:,
10
+ headings:,
11
+ rows:,
12
12
  style: { border_x: "~", border_i: "~" }
13
13
  )
14
14
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Datory
4
4
  module Context
5
- module Callable
5
+ module Callable # rubocop:disable Metrics/ModuleLength
6
6
  def form(model)
7
7
  Datory::Attributes::Form.new(self, model)
8
8
  end
@@ -52,8 +52,8 @@ module Datory
52
52
  message = "Failed to parse data for deserialization: #{e.message}"
53
53
 
54
54
  raise Datory::Exceptions::DeserializationError.new(
55
- context: context,
56
- message: message,
55
+ context:,
56
+ message:,
57
57
  meta: { original_exception: e }
58
58
  )
59
59
  end
@@ -72,13 +72,13 @@ module Datory
72
72
 
73
73
  direction = direction.to_s.inquiry
74
74
 
75
- _to_model(context, direction: direction, **attributes)
75
+ _to_model(context, direction:, **attributes)
76
76
  end
77
77
 
78
78
  def describe
79
79
  Datory::Attributes::Descriptor.describe(
80
80
  service_class_name: name,
81
- collection_of_attributes: collection_of_attributes
81
+ collection_of_attributes:
82
82
  )
83
83
  end
84
84
  alias table describe
@@ -100,8 +100,8 @@ module Datory
100
100
  def _serialize(context, model)
101
101
  context.send(
102
102
  :_serialize,
103
- model: model,
104
- collection_of_attributes: collection_of_attributes
103
+ model:,
104
+ collection_of_attributes:
105
105
  )
106
106
  end
107
107
 
@@ -109,16 +109,16 @@ module Datory
109
109
  context.send(
110
110
  :_deserialize,
111
111
  incoming_attributes: attributes.symbolize_keys,
112
- collection_of_attributes: collection_of_attributes
112
+ collection_of_attributes:
113
113
  )
114
114
  end
115
115
 
116
116
  def _to_model(context, direction:, **attributes)
117
117
  context.send(
118
118
  :_to_model,
119
- direction: direction,
120
- attributes: attributes,
121
- collection_of_attributes: collection_of_attributes
119
+ direction:,
120
+ attributes:,
121
+ collection_of_attributes:
122
122
  )
123
123
  end
124
124
 
@@ -29,23 +29,23 @@ module Datory
29
29
 
30
30
  def _serialize(model:, collection_of_attributes:)
31
31
  serialize(
32
- model: model,
33
- collection_of_attributes: collection_of_attributes
32
+ model:,
33
+ collection_of_attributes:
34
34
  )
35
35
  end
36
36
 
37
37
  def _deserialize(incoming_attributes:, collection_of_attributes:)
38
38
  deserialize(
39
- incoming_attributes: incoming_attributes,
40
- collection_of_attributes: collection_of_attributes
39
+ incoming_attributes:,
40
+ collection_of_attributes:
41
41
  )
42
42
  end
43
43
 
44
44
  def _to_model(direction:, attributes:, collection_of_attributes:)
45
45
  to_model(
46
- direction: direction,
47
- attributes: attributes,
48
- collection_of_attributes: collection_of_attributes
46
+ direction:,
47
+ attributes:,
48
+ collection_of_attributes:
49
49
  )
50
50
  end
51
51
 
@@ -5,14 +5,14 @@ module Datory
5
5
  class Builder < Base
6
6
  TRANSFORMATIONS = {
7
7
  SERIALIZATION: {
8
- Symbol => ->(value) { value.to_sym },
9
- String => ->(value) { value.to_s },
10
- Integer => ->(value) { value.to_i },
11
- Float => ->(value) { value.to_f },
12
- Date => ->(value) { value.to_s },
13
- Time => ->(value) { value.to_s },
14
- DateTime => ->(value) { value.to_s },
15
- ActiveSupport::Duration => ->(value) { value.iso8601 }
8
+ Symbol => lambda(&:to_sym),
9
+ String => lambda(&:to_s),
10
+ Integer => lambda(&:to_i),
11
+ Float => lambda(&:to_f),
12
+ Date => lambda(&:to_s),
13
+ Time => lambda(&:to_s),
14
+ DateTime => lambda(&:to_s),
15
+ ActiveSupport::Duration => lambda(&:iso8601)
16
16
  },
17
17
  DESERIALIZATION: {
18
18
  # NOTE: These types do not need to be cast automatically:
@@ -4,8 +4,8 @@ module Datory
4
4
  module VERSION
5
5
  MAJOR = 2
6
6
  MINOR = 2
7
- PATCH = 0
8
- PRE = "rc2"
7
+ PATCH = 1
8
+ PRE = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datory
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0.rc2
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-09-30 00:00:00.000000000 Z
10
+ date: 2025-02-19 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -50,14 +49,14 @@ dependencies:
50
49
  requirements:
51
50
  - - ">="
52
51
  - !ruby/object:Gem::Version
53
- version: 2.9.0.rc4
52
+ version: 2.9.0
54
53
  type: :runtime
55
54
  prerelease: false
56
55
  version_requirements: !ruby/object:Gem::Requirement
57
56
  requirements:
58
57
  - - ">="
59
58
  - !ruby/object:Gem::Version
60
- version: 2.9.0.rc4
59
+ version: 2.9.0
61
60
  - !ruby/object:Gem::Dependency
62
61
  name: terminal-table
63
62
  requirement: !ruby/object:Gem::Requirement
@@ -143,61 +142,19 @@ dependencies:
143
142
  - !ruby/object:Gem::Version
144
143
  version: '3.12'
145
144
  - !ruby/object:Gem::Dependency
146
- name: rubocop
145
+ name: servactory-rubocop
147
146
  requirement: !ruby/object:Gem::Requirement
148
147
  requirements:
149
- - - "~>"
150
- - !ruby/object:Gem::Version
151
- version: '1.57'
152
- type: :development
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - "~>"
157
- - !ruby/object:Gem::Version
158
- version: '1.57'
159
- - !ruby/object:Gem::Dependency
160
- name: rubocop-performance
161
- requirement: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - "~>"
164
- - !ruby/object:Gem::Version
165
- version: '1.19'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - "~>"
171
- - !ruby/object:Gem::Version
172
- version: '1.19'
173
- - !ruby/object:Gem::Dependency
174
- name: rubocop-rake
175
- requirement: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: '0.6'
180
- type: :development
181
- prerelease: false
182
- version_requirements: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - "~>"
185
- - !ruby/object:Gem::Version
186
- version: '0.6'
187
- - !ruby/object:Gem::Dependency
188
- name: rubocop-rspec
189
- requirement: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - "~>"
148
+ - - ">="
192
149
  - !ruby/object:Gem::Version
193
- version: '2.24'
150
+ version: '0.5'
194
151
  type: :development
195
152
  prerelease: false
196
153
  version_requirements: !ruby/object:Gem::Requirement
197
154
  requirements:
198
- - - "~>"
155
+ - - ">="
199
156
  - !ruby/object:Gem::Version
200
- version: '2.24'
157
+ version: '0.5'
201
158
  description: A set of tools for building reliable services of any complexity
202
159
  email:
203
160
  - profox.rus@gmail.com
@@ -250,7 +207,6 @@ metadata:
250
207
  bug_tracker_uri: https://github.com/servactory/datory/issues
251
208
  changelog_uri: https://github.com/servactory/datory/blob/master/CHANGELOG.md
252
209
  rubygems_mfa_required: 'true'
253
- post_install_message:
254
210
  rdoc_options: []
255
211
  require_paths:
256
212
  - lib
@@ -258,15 +214,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
258
214
  requirements:
259
215
  - - ">="
260
216
  - !ruby/object:Gem::Version
261
- version: 3.0.0
217
+ version: 3.1.0
262
218
  required_rubygems_version: !ruby/object:Gem::Requirement
263
219
  requirements:
264
220
  - - ">="
265
221
  - !ruby/object:Gem::Version
266
222
  version: '0'
267
223
  requirements: []
268
- rubygems_version: 3.5.16
269
- signing_key:
224
+ rubygems_version: 3.6.2
270
225
  specification_version: 4
271
226
  summary: A set of tools for building reliable services of any complexity
272
227
  test_files: []