datory 2.2.0.rc2 → 2.2.0

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: 1763a8028c249bf60dd2f07861f5eae4d74055fa3c54f194d945dc679a5d5dd9
4
- data.tar.gz: d98843e8292925b82c9a09f21354eec56e141a50fc6dbc0a152837c6f059a33b
3
+ metadata.gz: 74e78021b06904cb98ca74df704b94917ea3fd7fb2ae29cfb81af23fe91e61a4
4
+ data.tar.gz: b998676031dfe827858d18b7a407558a25baaddc255ce2642257931c1f8dcbb7
5
5
  SHA512:
6
- metadata.gz: 5250ce51ddf8946501529bd3dc1716d83f8c2f8ee36d564578e12d7a5fcee7ea6d9d3d1fb126e9d2f363e12ca84fc32434acf077c8c2e78aeeb5efa15a47af3a
7
- data.tar.gz: 458ab398ebabd8ce06a7b6ff031f81a39a00ceab611962279b23fcf5fe90a50e783293d53ec8f1807817099be2c4713e92738fadbb15350179f71d576a12d8e8
6
+ metadata.gz: af624036d14873c08e9352f30676c7c4b5f61c42f63c9e0dd8545493ce1e44f2a502e2110cdb41b91e217022a1e5bff63ae30eca41f0dc32a8665064504a9e93
7
+ data.tar.gz: 1af640a6856fa520f76d1e6ef774dfca12f0b9e0712de5627092c9e12fbee0371f9df75a1db4af23a58321a5ed4c0ebabc60c1bc2ae2ede1e66c9e103f671b7f
@@ -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:
@@ -5,7 +5,7 @@ module Datory
5
5
  MAJOR = 2
6
6
  MINOR = 2
7
7
  PATCH = 0
8
- PRE = "rc2"
8
+ PRE = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-30 00:00:00.000000000 Z
11
+ date: 2024-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -50,14 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: 2.9.0.rc4
53
+ version: 2.9.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 2.9.0.rc4
60
+ version: 2.9.0
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: terminal-table
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -143,61 +143,19 @@ dependencies:
143
143
  - !ruby/object:Gem::Version
144
144
  version: '3.12'
145
145
  - !ruby/object:Gem::Dependency
146
- name: rubocop
146
+ name: servactory-rubocop
147
147
  requirement: !ruby/object:Gem::Requirement
148
148
  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
- - - "~>"
149
+ - - ">="
192
150
  - !ruby/object:Gem::Version
193
- version: '2.24'
151
+ version: '0.5'
194
152
  type: :development
195
153
  prerelease: false
196
154
  version_requirements: !ruby/object:Gem::Requirement
197
155
  requirements:
198
- - - "~>"
156
+ - - ">="
199
157
  - !ruby/object:Gem::Version
200
- version: '2.24'
158
+ version: '0.5'
201
159
  description: A set of tools for building reliable services of any complexity
202
160
  email:
203
161
  - profox.rus@gmail.com
@@ -258,14 +216,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
258
216
  requirements:
259
217
  - - ">="
260
218
  - !ruby/object:Gem::Version
261
- version: 3.0.0
219
+ version: 3.1.0
262
220
  required_rubygems_version: !ruby/object:Gem::Requirement
263
221
  requirements:
264
222
  - - ">="
265
223
  - !ruby/object:Gem::Version
266
224
  version: '0'
267
225
  requirements: []
268
- rubygems_version: 3.5.16
226
+ rubygems_version: 3.5.22
269
227
  signing_key:
270
228
  specification_version: 4
271
229
  summary: A set of tools for building reliable services of any complexity