privat_bank_business_api 0.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.
Files changed (102) hide show
  1. checksums.yaml +7 -0
  2. data/.devcontainer/Dockerfile +17 -0
  3. data/.devcontainer/devcontainer.json +33 -0
  4. data/.devcontainer/post-create.sh +8 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +9 -0
  7. data/.vscode/settings.json +6 -0
  8. data/CHANGELOG.md +12 -0
  9. data/CODE_OF_CONDUCT.md +132 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +123 -0
  12. data/Rakefile +12 -0
  13. data/lib/pb_api/base_transformer.rb +19 -0
  14. data/lib/pb_api/client.rb +41 -0
  15. data/lib/pb_api/models/balance.rb +79 -0
  16. data/lib/pb_api/models/base_struct.rb +30 -0
  17. data/lib/pb_api/models/transaction.rb +114 -0
  18. data/lib/pb_api/pagination_helper.rb +73 -0
  19. data/lib/pb_api/resource.rb +97 -0
  20. data/lib/pb_api/resources/balance_resource.rb +40 -0
  21. data/lib/pb_api/resources/transaction_resource.rb +105 -0
  22. data/lib/pb_api/transformers/balance_transformer.rb +35 -0
  23. data/lib/pb_api/transformers/transaction_transformer.rb +46 -0
  24. data/lib/pb_api/types.rb +8 -0
  25. data/lib/pb_api/version.rb +5 -0
  26. data/lib/pb_api.rb +34 -0
  27. data/sig/privat_bank_buisness_api.rbs +4 -0
  28. data/sorbet/config +4 -0
  29. data/sorbet/rbi/annotations/.gitattributes +1 -0
  30. data/sorbet/rbi/annotations/faraday.rbi +17 -0
  31. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  32. data/sorbet/rbi/gems/.gitattributes +1 -0
  33. data/sorbet/rbi/gems/ast@2.4.2.rbi +585 -0
  34. data/sorbet/rbi/gems/benchmark@0.4.0.rbi +618 -0
  35. data/sorbet/rbi/gems/bigdecimal@3.1.9.rbi +9 -0
  36. data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +9 -0
  37. data/sorbet/rbi/gems/date@3.4.1.rbi +75 -0
  38. data/sorbet/rbi/gems/diff-lcs@1.6.0.rbi +1134 -0
  39. data/sorbet/rbi/gems/dry-core@1.1.0.rbi +9 -0
  40. data/sorbet/rbi/gems/dry-inflector@1.2.0.rbi +9 -0
  41. data/sorbet/rbi/gems/dry-logic@1.6.0.rbi +9 -0
  42. data/sorbet/rbi/gems/dry-struct@1.7.1.rbi +925 -0
  43. data/sorbet/rbi/gems/dry-transformer@1.0.1.rbi +1512 -0
  44. data/sorbet/rbi/gems/dry-types@1.8.2.rbi +9 -0
  45. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  46. data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +9 -0
  47. data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +9 -0
  48. data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +9 -0
  49. data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +9 -0
  50. data/sorbet/rbi/gems/faraday-multipart@1.1.0.rbi +9 -0
  51. data/sorbet/rbi/gems/faraday-net_http@1.0.2.rbi +9 -0
  52. data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +9 -0
  53. data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +9 -0
  54. data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +9 -0
  55. data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +9 -0
  56. data/sorbet/rbi/gems/faraday@1.10.4.rbi +9 -0
  57. data/sorbet/rbi/gems/faraday_middleware@1.2.1.rbi +9 -0
  58. data/sorbet/rbi/gems/i18n@1.14.7.rbi +2208 -0
  59. data/sorbet/rbi/gems/ice_nine@0.11.2.rbi +9 -0
  60. data/sorbet/rbi/gems/io-console@0.8.0.rbi +9 -0
  61. data/sorbet/rbi/gems/json@2.10.1.rbi +2120 -0
  62. data/sorbet/rbi/gems/language_server-protocol@3.17.0.4.rbi +9 -0
  63. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +86 -0
  64. data/sorbet/rbi/gems/logger@1.6.6.rbi +940 -0
  65. data/sorbet/rbi/gems/money@6.19.0.rbi +2260 -0
  66. data/sorbet/rbi/gems/multipart-post@2.4.1.rbi +9 -0
  67. data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
  68. data/sorbet/rbi/gems/parallel@1.26.3.rbi +291 -0
  69. data/sorbet/rbi/gems/parser@3.3.7.1.rbi +5525 -0
  70. data/sorbet/rbi/gems/pp@0.6.2.rbi +368 -0
  71. data/sorbet/rbi/gems/prettyprint@0.2.0.rbi +477 -0
  72. data/sorbet/rbi/gems/prism@1.3.0.rbi +41403 -0
  73. data/sorbet/rbi/gems/psych@5.2.3.rbi +2435 -0
  74. data/sorbet/rbi/gems/racc@1.8.1.rbi +164 -0
  75. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
  76. data/sorbet/rbi/gems/rake@13.2.1.rbi +3028 -0
  77. data/sorbet/rbi/gems/rbi@0.2.4.rbi +4542 -0
  78. data/sorbet/rbi/gems/rdoc@6.12.0.rbi +12758 -0
  79. data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +3795 -0
  80. data/sorbet/rbi/gems/reline@0.6.0.rbi +2451 -0
  81. data/sorbet/rbi/gems/rspec-core@3.13.3.rbi +10986 -0
  82. data/sorbet/rbi/gems/rspec-expectations@3.13.3.rbi +8183 -0
  83. data/sorbet/rbi/gems/rspec-mocks@3.13.2.rbi +5341 -0
  84. data/sorbet/rbi/gems/rspec-support@3.13.2.rbi +1630 -0
  85. data/sorbet/rbi/gems/rspec@3.13.0.rbi +83 -0
  86. data/sorbet/rbi/gems/rubocop-ast@1.38.0.rbi +7654 -0
  87. data/sorbet/rbi/gems/rubocop@1.72.2.rbi +61026 -0
  88. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
  89. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +9 -0
  90. data/sorbet/rbi/gems/spoom@1.5.4.rbi +5026 -0
  91. data/sorbet/rbi/gems/stringio@3.1.5.rbi +9 -0
  92. data/sorbet/rbi/gems/tapioca@0.16.11.rbi +3656 -0
  93. data/sorbet/rbi/gems/thor@1.3.2.rbi +4378 -0
  94. data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +132 -0
  95. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +251 -0
  96. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
  97. data/sorbet/rbi/gems/yard@0.9.37.rbi +18379 -0
  98. data/sorbet/rbi/gems/zeitwerk@2.7.2.rbi +9 -0
  99. data/sorbet/rbi/todo.rbi +17 -0
  100. data/sorbet/tapioca/config.yml +13 -0
  101. data/sorbet/tapioca/require.rb +8 -0
  102. metadata +231 -0
@@ -0,0 +1,1512 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `dry-transformer` gem.
5
+ # Please instead update this file by running `bin/tapioca gem dry-transformer`.
6
+
7
+
8
+ # source://dry-transformer//lib/dry/transformer/constants.rb#3
9
+ module Dry
10
+ class << self
11
+ # source://dry-core/1.1.0/lib/dry/core.rb#52
12
+ def Equalizer(*keys, **options); end
13
+
14
+ # source://dry-struct/1.7.1/lib/dry/struct.rb#30
15
+ def Struct(attributes = T.unsafe(nil), &block); end
16
+
17
+ # source://dry-types/1.8.2/lib/dry/types.rb#253
18
+ def Types(*namespaces, default: T.unsafe(nil), **aliases); end
19
+ end
20
+ end
21
+
22
+ # source://dry-transformer//lib/dry/transformer/constants.rb#4
23
+ module Dry::Transformer
24
+ class << self
25
+ # @api public
26
+ # @see Pipe.[]
27
+ #
28
+ # source://dry-transformer//lib/dry/transformer.rb#12
29
+ def [](registry); end
30
+
31
+ # @api private
32
+ #
33
+ # source://dry-transformer//lib/dry/transformer.rb#17
34
+ def loader; end
35
+ end
36
+ end
37
+
38
+ # Transformation functions for Array objects
39
+ #
40
+ # @api public
41
+ # @example
42
+ # require 'dry/transformer/array'
43
+ #
44
+ # include Dry::Transformer::Helper
45
+ #
46
+ # fn = t(:map_array, t(:symbolize_keys)) >> t(:wrap, :address, [:city, :zipcode])
47
+ #
48
+ # fn.call(
49
+ # [
50
+ # { 'city' => 'Boston', 'zipcode' => '123' },
51
+ # { 'city' => 'NYC', 'zipcode' => '312' }
52
+ # ]
53
+ # )
54
+ # # => [{:address=>{:city=>"Boston", :zipcode=>"123"}}, {:address=>{:city=>"NYC", :zipcode=>"312"}}]
55
+ #
56
+ # source://dry-transformer//lib/dry/transformer/array_transformations.rb#23
57
+ module Dry::Transformer::ArrayTransformations
58
+ extend ::Dry::Transformer::Registry
59
+
60
+ class << self
61
+ # Adds missing keys with nil value to all tuples in array
62
+ #
63
+ # @api public
64
+ # @param keys [Array]
65
+ # @return [Array]
66
+ #
67
+ # source://dry-transformer//lib/dry/transformer/array_transformations.rb#173
68
+ def add_keys(array, keys); end
69
+
70
+ # @api public
71
+ #
72
+ # source://dry-transformer//lib/dry/transformer/array_transformations.rb#121
73
+ def combine(array, mappings); end
74
+
75
+ # Converts the array of hashes to array of values, extracted by given key
76
+ #
77
+ # @api public
78
+ # @example
79
+ # fn = t(:extract_key, :name)
80
+ # fn.call [
81
+ # { name: 'Alice', role: 'sender' },
82
+ # { name: 'Bob', role: 'receiver' },
83
+ # { role: 'listener' }
84
+ # ]
85
+ # # => ['Alice', 'Bob', nil]
86
+ # @param array [Array<Hash>] The input array of hashes
87
+ # @param key [Object] The key to extract values by
88
+ # @return [Array]
89
+ #
90
+ # source://dry-transformer//lib/dry/transformer/array_transformations.rb#142
91
+ def extract_key(array, key); end
92
+
93
+ # Group array values using provided root key and value keys
94
+ #
95
+ # @api public
96
+ # @example
97
+ # fn = Dry::Transformer(:group, :tags, [:tag])
98
+ #
99
+ # fn.call [
100
+ # { task: 'Group it', tag: 'task' },
101
+ # { task: 'Group it', tag: 'important' }
102
+ # ]
103
+ # # => [{ task: 'Group it', tags: [{ tag: 'task' }, { tag: 'important' }]]
104
+ # @param array [Array] The input array
105
+ # @param key [Object] The nesting root key
106
+ # @param keys [Object] The nesting value keys
107
+ # @return [Array]
108
+ #
109
+ # source://dry-transformer//lib/dry/transformer/array_transformations.rb#82
110
+ def group(array, key, keys); end
111
+
112
+ # Wraps every value of the array to tuple with given key
113
+ #
114
+ # The transformation partially inverses the `extract_key`.
115
+ #
116
+ # @api public
117
+ # @example
118
+ # fn = t(:insert_key, 'name')
119
+ # fn.call ['Alice', 'Bob', nil]
120
+ # # => [{ 'name' => 'Alice' }, { 'name' => 'Bob' }, { 'name' => nil }]
121
+ # @param array [Array<Hash>] The input array of hashes
122
+ # @param key [Object] The key to extract values by
123
+ # @return [Array]
124
+ #
125
+ # source://dry-transformer//lib/dry/transformer/array_transformations.rb#161
126
+ def insert_key(array, key); end
127
+
128
+ # Map array values using transformation function
129
+ #
130
+ # @api public
131
+ # @example
132
+ #
133
+ # fn = Dry::Transformer(:map_array, -> v { v.upcase })
134
+ #
135
+ # fn.call ['foo', 'bar'] # => ["FOO", "BAR"]
136
+ # @param array [Array] The input array
137
+ # @param fn [Proc] The transformation function
138
+ # @return [Array]
139
+ #
140
+ # source://dry-transformer//lib/dry/transformer/array_transformations.rb#40
141
+ def map_array(array, fn); end
142
+
143
+ # Ungroup array values using provided root key and value keys
144
+ #
145
+ # @api public
146
+ # @example
147
+ # fn = Dry::Transformer(:ungroup, :tags, [:tag])
148
+ #
149
+ # fn.call [
150
+ # { task: 'Group it', tags: [{ tag: 'task' }, { tag: 'important' }] }
151
+ # ]
152
+ # # => [
153
+ # { task: 'Group it', tag: 'task' },
154
+ # { task: 'Group it', tag: 'important' }
155
+ # ]
156
+ # @param array [Array] The input array
157
+ # @param key [Object] The nesting root key
158
+ # @param keys [Object] The nesting value keys
159
+ # @return [Array]
160
+ #
161
+ # source://dry-transformer//lib/dry/transformer/array_transformations.rb#117
162
+ def ungroup(array, key, keys); end
163
+
164
+ # Wrap array values using HashTransformations.nest function
165
+ #
166
+ # @api public
167
+ # @example
168
+ # fn = Dry::Transformer(:wrap, :address, [:city, :zipcode])
169
+ #
170
+ # fn.call [{ city: 'NYC', zipcode: '123' }]
171
+ # # => [{ address: { city: 'NYC', zipcode: '123' } }]
172
+ # @param array [Array] The input array
173
+ # @param key [Object] The nesting root key
174
+ # @param keys [Object] The nesting value keys
175
+ # @return [Array]
176
+ #
177
+ # source://dry-transformer//lib/dry/transformer/array_transformations.rb#59
178
+ def wrap(array, key, keys); end
179
+ end
180
+ end
181
+
182
+ # source://dry-transformer//lib/dry/transformer/array_transformations/combine.rb#6
183
+ class Dry::Transformer::ArrayTransformations::Combine
184
+ class << self
185
+ # source://dry-transformer//lib/dry/transformer/array_transformations/combine.rb#10
186
+ def combine(array, mappings); end
187
+
188
+ private
189
+
190
+ # source://dry-transformer//lib/dry/transformer/array_transformations/combine.rb#24
191
+ def add_groups_to_element(element, groups, mappings); end
192
+
193
+ # source://dry-transformer//lib/dry/transformer/array_transformations/combine.rb#32
194
+ def element_candidates(element, candidates, keys); end
195
+
196
+ # source://dry-transformer//lib/dry/transformer/array_transformations/combine.rb#56
197
+ def element_candidates_key(element, keys); end
198
+
199
+ # source://dry-transformer//lib/dry/transformer/array_transformations/combine.rb#43
200
+ def group_candidates(candidates, mapping); end
201
+
202
+ # source://dry-transformer//lib/dry/transformer/array_transformations/combine.rb#49
203
+ def group_candidates_by_keys(candidates, keys); end
204
+
205
+ # source://dry-transformer//lib/dry/transformer/array_transformations/combine.rb#36
206
+ def group_nodes(nodes, mappings); end
207
+ end
208
+ end
209
+
210
+ # source://dry-transformer//lib/dry/transformer/array_transformations/combine.rb#7
211
+ Dry::Transformer::ArrayTransformations::Combine::EMPTY_ARRAY = T.let(T.unsafe(nil), Array)
212
+
213
+ # Transformation functions for Classes
214
+ #
215
+ # @api public
216
+ # @example
217
+ # require 'dry/transformer/class'
218
+ #
219
+ # include Dry::Transformer::Helper
220
+ #
221
+ # fn = t(:constructor_inject, Struct)
222
+ #
223
+ # fn['User', :name, :age]
224
+ # # => Struct::User
225
+ #
226
+ # source://dry-transformer//lib/dry/transformer/class_transformations.rb#18
227
+ module Dry::Transformer::ClassTransformations
228
+ extend ::Dry::Transformer::Registry
229
+
230
+ class << self
231
+ # Inject given arguments into the constructor of the class
232
+ #
233
+ # @api public
234
+ # @example
235
+ # Transproct(:constructor_inject, Struct)['User', :name, :age]
236
+ # # => Struct::User
237
+ # @param A [*Mixed] list of arguments to inject
238
+ # @return [Object] An instance of the given klass
239
+ #
240
+ # source://dry-transformer//lib/dry/transformer/class_transformations.rb#32
241
+ def constructor_inject(*args, klass); end
242
+
243
+ # Set instance variables from the hash argument (key/value pairs) on the object
244
+ #
245
+ # @api public
246
+ # @example
247
+ # Dry::Transformer(:set_ivars, Object)[name: 'Jane', age: 25]
248
+ # # => #<Object:0x007f411d06a210 @name="Jane", @age=25>
249
+ # @param [Object]
250
+ # @return [Object]
251
+ #
252
+ # source://dry-transformer//lib/dry/transformer/class_transformations.rb#47
253
+ def set_ivars(ivar_hash, klass); end
254
+ end
255
+ end
256
+
257
+ # Coercion functions for common types
258
+ #
259
+ # @api public
260
+ #
261
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#13
262
+ module Dry::Transformer::Coercions
263
+ extend ::Dry::Transformer::Registry
264
+
265
+ class << self
266
+ # Does nothing and returns a value
267
+ #
268
+ # @api public
269
+ # @example
270
+ # fn = Coercions[:identity]
271
+ # fn[:foo] # => :foo
272
+ # @param value [Object]
273
+ # @return [Object]
274
+ #
275
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#34
276
+ def identity(value = T.unsafe(nil)); end
277
+
278
+ # Coerce value into a boolean
279
+ #
280
+ # @api public
281
+ # @example
282
+ # Dry::Transformer(:to_boolean)['true']
283
+ # # => true
284
+ # Dry::Transformer(:to_boolean)['f']
285
+ # # => false
286
+ # @param value [Object] The input value
287
+ # @return [TrueClass, FalseClass]
288
+ #
289
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#126
290
+ def to_boolean(value); end
291
+
292
+ # Coerce value into a date
293
+ #
294
+ # @api public
295
+ # @example
296
+ # Dry::Transformer(:to_date)['2015-04-14']
297
+ # # => #<Date: 2015-04-14 ((2457127j,0s,0n),+0s,2299161j)>
298
+ # @param value [Object] The input value
299
+ # @return [Date]
300
+ #
301
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#141
302
+ def to_date(value); end
303
+
304
+ # Coerce value into a datetime
305
+ #
306
+ # @api public
307
+ # @example
308
+ # Dry::Transformer(:to_datetime)['2015-04-14 12:01:45']
309
+ # # => #<DateTime: 2015-04-14T12:01:45+00:00 ((2457127j,43305s,0n),+0s,2299161j)>
310
+ # @param value [Object] The input value
311
+ # @return [DateTime]
312
+ #
313
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#171
314
+ def to_datetime(value); end
315
+
316
+ # Coerce value into a decimal
317
+ #
318
+ # @api public
319
+ # @example
320
+ # Dry::Transformer(:to_decimal)[1.2]
321
+ # # => #<BigDecimal:7fca32acea50,'0.12E1',18(36)>
322
+ # @param value [Object] The input value
323
+ # @return [Decimal]
324
+ #
325
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#109
326
+ def to_decimal(value); end
327
+
328
+ # Coerce value into a float
329
+ #
330
+ # @api public
331
+ # @example
332
+ # Dry::Transformer(:to_float)['1.2']
333
+ # # => 1.2
334
+ # @param value [Object] The input value
335
+ # @return [Float]
336
+ #
337
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#94
338
+ def to_float(value); end
339
+
340
+ # Coerce value into a integer
341
+ #
342
+ # @api public
343
+ # @example
344
+ # Dry::Transformer(:to_integer)['1']
345
+ # # => 1
346
+ # @param value [Object] The input value
347
+ # @return [Integer]
348
+ #
349
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#79
350
+ def to_integer(value); end
351
+
352
+ # Coerce value into a string
353
+ #
354
+ # @api public
355
+ # @example
356
+ # Dry::Transformer(:to_string)[1]
357
+ # # => "1"
358
+ # @param value [Object] The input value
359
+ # @return [String]
360
+ #
361
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#49
362
+ def to_string(value); end
363
+
364
+ # Coerce value into a symbol
365
+ #
366
+ # @api public
367
+ # @example
368
+ # Dry::Transformer(:to_symbol)['foo']
369
+ # # => :foo
370
+ # @param value [#to_s] The input value
371
+ # @return [Symbol]
372
+ #
373
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#64
374
+ def to_symbol(value); end
375
+
376
+ # Coerce value into a time
377
+ #
378
+ # @api public
379
+ # @example
380
+ # Dry::Transformer(:to_time)['2015-04-14 12:01:45']
381
+ # # => 2015-04-14 12:01:45 +0200
382
+ # @param value [Object] The input value
383
+ # @return [Time]
384
+ #
385
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#156
386
+ def to_time(value); end
387
+
388
+ # Coerce value into an array containing tuples only
389
+ #
390
+ # If the source is not an array, or doesn't contain a tuple, returns
391
+ # an array with one empty tuple
392
+ #
393
+ # @api public
394
+ # @example
395
+ # Dry::Transformer(:to_tuples)[:foo] # => [{}]
396
+ # Dry::Transformer(:to_tuples)[[]] # => [{}]
397
+ # Dry::Transformer(:to_tuples)[[{ foo: :FOO, :bar }]] # => [{ foo: :FOO }]
398
+ # @param value [Object]
399
+ # @return [Array<Hash>]
400
+ #
401
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#189
402
+ def to_tuples(value); end
403
+ end
404
+ end
405
+
406
+ # @api public
407
+ #
408
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#19
409
+ Dry::Transformer::Coercions::BOOLEAN_MAP = T.let(T.unsafe(nil), Hash)
410
+
411
+ # @api public
412
+ #
413
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#17
414
+ Dry::Transformer::Coercions::FALSE_VALUES = T.let(T.unsafe(nil), Array)
415
+
416
+ # @api public
417
+ #
418
+ # source://dry-transformer//lib/dry/transformer/coercions.rb#16
419
+ Dry::Transformer::Coercions::TRUE_VALUES = T.let(T.unsafe(nil), Array)
420
+
421
+ # @api private
422
+ #
423
+ # source://dry-transformer//lib/dry/transformer/compiler.rb#6
424
+ class Dry::Transformer::Compiler
425
+ # @api private
426
+ # @return [Compiler] a new instance of Compiler
427
+ #
428
+ # source://dry-transformer//lib/dry/transformer/compiler.rb#11
429
+ def initialize(registry, transformer = T.unsafe(nil)); end
430
+
431
+ # @api private
432
+ #
433
+ # source://dry-transformer//lib/dry/transformer/compiler.rb#16
434
+ def call(ast); end
435
+
436
+ # @api private
437
+ #
438
+ # source://dry-transformer//lib/dry/transformer/compiler.rb#9
439
+ def registry; end
440
+
441
+ # @api private
442
+ #
443
+ # source://dry-transformer//lib/dry/transformer/compiler.rb#9
444
+ def transformer; end
445
+
446
+ # @api private
447
+ #
448
+ # source://dry-transformer//lib/dry/transformer/compiler.rb#20
449
+ def visit(node); end
450
+
451
+ # @api private
452
+ #
453
+ # source://dry-transformer//lib/dry/transformer/compiler.rb#38
454
+ def visit_arg(arg); end
455
+
456
+ # @api private
457
+ #
458
+ # source://dry-transformer//lib/dry/transformer/compiler.rb#25
459
+ def visit_fn(node); end
460
+
461
+ # @api private
462
+ #
463
+ # source://dry-transformer//lib/dry/transformer/compiler.rb#42
464
+ def visit_t(node); end
465
+ end
466
+
467
+ # @api private
468
+ #
469
+ # source://dry-transformer//lib/dry/transformer/compiler.rb#7
470
+ class Dry::Transformer::Compiler::InvalidFunctionNameError < ::StandardError; end
471
+
472
+ # Composition of two functions
473
+ #
474
+ # @api private
475
+ #
476
+ # source://dry-transformer//lib/dry/transformer/composite.rb#8
477
+ class Dry::Transformer::Composite
478
+ # @api private
479
+ # @return [Composite] a new instance of Composite
480
+ #
481
+ # source://dry-transformer//lib/dry/transformer/composite.rb#20
482
+ def initialize(left, right); end
483
+
484
+ # @api public
485
+ # @see Function#compose
486
+ #
487
+ # source://dry-transformer//lib/dry/transformer/composite.rb#40
488
+ def +(other); end
489
+
490
+ # @api public
491
+ # @see Function#compose
492
+ #
493
+ # source://dry-transformer//lib/dry/transformer/composite.rb#40
494
+ def >>(other); end
495
+
496
+ # Call right side with the result from the left side
497
+ #
498
+ # @api public
499
+ # @param value [Object] The input value
500
+ # @return [Object]
501
+ #
502
+ # source://dry-transformer//lib/dry/transformer/composite.rb#32
503
+ def [](value); end
504
+
505
+ # Call right side with the result from the left side
506
+ #
507
+ # @api public
508
+ # @param value [Object] The input value
509
+ # @return [Object]
510
+ #
511
+ # source://dry-transformer//lib/dry/transformer/composite.rb#32
512
+ def call(value); end
513
+
514
+ # @api public
515
+ # @see Function#compose
516
+ #
517
+ # source://dry-transformer//lib/dry/transformer/composite.rb#40
518
+ def compose(other); end
519
+
520
+ # @api private
521
+ # @return [Proc]
522
+ #
523
+ # source://dry-transformer//lib/dry/transformer/composite.rb#12
524
+ def left; end
525
+
526
+ # @api private
527
+ # @return [Proc]
528
+ #
529
+ # source://dry-transformer//lib/dry/transformer/composite.rb#17
530
+ def right; end
531
+
532
+ # @api public
533
+ # @see Function#to_ast
534
+ #
535
+ # source://dry-transformer//lib/dry/transformer/composite.rb#49
536
+ def to_ast; end
537
+ end
538
+
539
+ # Conditional transformation functions
540
+ #
541
+ # @api public
542
+ # @example
543
+ # require 'dry/transformer/conditional'
544
+ #
545
+ # include Dry::Transformer::Helper
546
+ #
547
+ # fn = t(:guard, -> s { s.is_a?(::String) }, -> s { s.to_sym })
548
+ #
549
+ # [fn[2], fn['Jane']]
550
+ # # => [2, :Jane]
551
+ #
552
+ # source://dry-transformer//lib/dry/transformer/conditional.rb#18
553
+ module Dry::Transformer::Conditional
554
+ extend ::Dry::Transformer::Registry
555
+
556
+ class << self
557
+ # Apply the transformation function to subject if the predicate returns true, or return un-modified
558
+ #
559
+ # @api public
560
+ # @example
561
+ # [2, 'Jane'].map do |subject|
562
+ # Dry::Transformer(:guard, -> s { s.is_a?(::String) }, -> s { s.to_sym })[subject]
563
+ # end
564
+ # # => [2, :Jane]
565
+ # @param [Mixed]
566
+ # @return [Mixed]
567
+ #
568
+ # source://dry-transformer//lib/dry/transformer/conditional.rb#51
569
+ def guard(value, predicate, fn); end
570
+
571
+ # Calls a function when type-check passes
572
+ #
573
+ # @api public
574
+ # @example
575
+ # fn = Dry::Transformer(:is, Array, -> arr { arr.map(&:upcase) })
576
+ # fn.call(['a', 'b', 'c']) # => ['A', 'B', 'C']
577
+ #
578
+ # fn = Dry::Transformer(:is, Array, -> arr { arr.map(&:upcase) })
579
+ # fn.call('foo') # => "foo"
580
+ # @param [Object]
581
+ # @param [Class]
582
+ # @param [Proc]
583
+ # @return [Object]
584
+ #
585
+ # source://dry-transformer//lib/dry/transformer/conditional.rb#71
586
+ def is(value, type, fn); end
587
+
588
+ # Negates the result of transformation
589
+ #
590
+ # @api public
591
+ # @example
592
+ # fn = Conditional[:not, -> value { value.is_a? ::String }]
593
+ # fn[:foo] # => true
594
+ # fn["foo"] # => false
595
+ # @param value [Object]
596
+ # @param fn [Proc]
597
+ # @return [Boolean]
598
+ #
599
+ # source://dry-transformer//lib/dry/transformer/conditional.rb#34
600
+ def not(value, fn); end
601
+ end
602
+ end
603
+
604
+ # source://dry-transformer//lib/dry/transformer/error.rb#5
605
+ class Dry::Transformer::Error < ::StandardError; end
606
+
607
+ # Transformation proc wrapper allowing composition of multiple procs into
608
+ # a data-transformation pipeline.
609
+ #
610
+ # This is used by Dry::Transformer to wrap registered methods.
611
+ #
612
+ # @api private
613
+ #
614
+ # source://dry-transformer//lib/dry/transformer/function.rb#11
615
+ class Dry::Transformer::Function
616
+ # @api private
617
+ # @return [Function] a new instance of Function
618
+ #
619
+ # source://dry-transformer//lib/dry/transformer/function.rb#34
620
+ def initialize(fn, options = T.unsafe(nil)); end
621
+
622
+ # Compose this function with another function or a proc
623
+ #
624
+ # @api public
625
+ # @param [Proc, Function]
626
+ # @return [Composite]
627
+ #
628
+ # source://dry-transformer//lib/dry/transformer/function.rb#61
629
+ def +(other); end
630
+
631
+ # @api public
632
+ #
633
+ # source://dry-transformer//lib/dry/transformer/function.rb#77
634
+ def ==(other); end
635
+
636
+ # Compose this function with another function or a proc
637
+ #
638
+ # @api public
639
+ # @param [Proc, Function]
640
+ # @return [Composite]
641
+ #
642
+ # source://dry-transformer//lib/dry/transformer/function.rb#61
643
+ def >>(other); end
644
+
645
+ # Call the wrapped proc
646
+ #
647
+ # @api public
648
+ # @param value [Object] The input value
649
+ #
650
+ # source://dry-transformer//lib/dry/transformer/function.rb#47
651
+ def [](*value); end
652
+
653
+ # Additional arguments that will be passed to the wrapped proc
654
+ #
655
+ # @api private
656
+ # @return [Array]
657
+ #
658
+ # source://dry-transformer//lib/dry/transformer/function.rb#24
659
+ def args; end
660
+
661
+ # Call the wrapped proc
662
+ #
663
+ # @api public
664
+ # @param value [Object] The input value
665
+ #
666
+ # source://dry-transformer//lib/dry/transformer/function.rb#47
667
+ def call(*value); end
668
+
669
+ # Compose this function with another function or a proc
670
+ #
671
+ # @api public
672
+ # @param [Proc, Function]
673
+ # @return [Composite]
674
+ #
675
+ # source://dry-transformer//lib/dry/transformer/function.rb#61
676
+ def compose(other); end
677
+
678
+ # @api public
679
+ #
680
+ # source://dry-transformer//lib/dry/transformer/function.rb#77
681
+ def eql?(other); end
682
+
683
+ # Wrapped proc or another composite function
684
+ #
685
+ # @api private
686
+ # @return [Proc, Composed]
687
+ #
688
+ # source://dry-transformer//lib/dry/transformer/function.rb#17
689
+ def fn; end
690
+
691
+ # @api public
692
+ # @return [<type] The name of the function] <type] The name of the function
693
+ #
694
+ # source://dry-transformer//lib/dry/transformer/function.rb#31
695
+ def name; end
696
+
697
+ # Return a simple AST representation of this function
698
+ #
699
+ # @api public
700
+ # @return [Array]
701
+ #
702
+ # source://dry-transformer//lib/dry/transformer/function.rb#89
703
+ def to_ast; end
704
+
705
+ # Converts a transproc to a simple proc
706
+ #
707
+ # @api private
708
+ # @return [Proc]
709
+ #
710
+ # source://dry-transformer//lib/dry/transformer/function.rb#98
711
+ def to_proc; end
712
+
713
+ # Return a new fn with curried args
714
+ #
715
+ # @api private
716
+ # @return [Function]
717
+ #
718
+ # source://dry-transformer//lib/dry/transformer/function.rb#72
719
+ def with(*args); end
720
+ end
721
+
722
+ # source://dry-transformer//lib/dry/transformer/error.rb#6
723
+ class Dry::Transformer::FunctionAlreadyRegisteredError < ::Dry::Transformer::Error; end
724
+
725
+ # source://dry-transformer//lib/dry/transformer/error.rb#8
726
+ class Dry::Transformer::FunctionNotFoundError < ::Dry::Transformer::Error
727
+ # @return [FunctionNotFoundError] a new instance of FunctionNotFoundError
728
+ #
729
+ # source://dry-transformer//lib/dry/transformer/error.rb#9
730
+ def initialize(function, source = T.unsafe(nil)); end
731
+ end
732
+
733
+ # Transformation functions for Hash objects
734
+ #
735
+ # @api public
736
+ # @example
737
+ # require 'dry/transformer/hash'
738
+ #
739
+ # include Dry::Transformer::Helper
740
+ #
741
+ # fn = t(:symbolize_keys) >> t(:nest, :address, [:street, :zipcode])
742
+ #
743
+ # fn["street" => "Street 1", "zipcode" => "123"]
744
+ # # => {:address => {:street => "Street 1", :zipcode => "123"}}
745
+ #
746
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#18
747
+ module Dry::Transformer::HashTransformations
748
+ extend ::Dry::Transformer::Registry
749
+
750
+ class << self
751
+ # Accepts specified keys from a hash
752
+ #
753
+ # @api public
754
+ # @example
755
+ # Dry::Transformer(:accept_keys, [:name])[name: 'Jane', email: 'jane@doe.org']
756
+ # # => {:name=>"Jane"}
757
+ # @param hash [Hash] The input hash
758
+ # @param keys [Array] The keys to be accepted
759
+ # @return [Hash]
760
+ #
761
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#208
762
+ def accept_keys(hash, keys); end
763
+
764
+ # Copy all keys in a hash using provided mapping hash
765
+ #
766
+ # @api public
767
+ # @example
768
+ # Dry::Transformer(:copy_keys, user_name: :name)[user_name: 'Jane']
769
+ # # => {:user_name => "Jane", :name => "Jane"}
770
+ # @param source_hash [Hash] The input hash
771
+ # @param mapping [Hash] The key-copy mapping
772
+ # @return [Hash]
773
+ #
774
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#170
775
+ def copy_keys(source_hash, mapping); end
776
+
777
+ # Merge a hash recursively
778
+ #
779
+ # @api public
780
+ # @example
781
+ #
782
+ # input = { 'foo' => 'bar', 'baz' => { 'one' => 1 } }
783
+ # other = { 'foo' => 'buz', 'baz' => { :one => 'one', :two => 2 } }
784
+ #
785
+ # t(:deep_merge)[input, other]
786
+ # # => { 'foo' => "buz", :baz => { :one => 'one', 'one' => 1, :two => 2 } }
787
+ # @param [Hash]
788
+ # @param [Hash]
789
+ # @return [Hash]
790
+ #
791
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#418
792
+ def deep_merge(hash, other); end
793
+
794
+ # Stringify keys in a hash recursively
795
+ #
796
+ # @api public
797
+ # @example
798
+ # input = { :foo => "bar", :baz => [{ :one => 1 }] }
799
+ #
800
+ # t(:deep_stringify_keys)[input]
801
+ # # => { "foo" => "bar", "baz" => [{ "one" => 1 }] }
802
+ # @param [Hash]
803
+ # @return [Hash]
804
+ #
805
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#109
806
+ def deep_stringify_keys(hash); end
807
+
808
+ # Symbolize keys in a hash recursively
809
+ #
810
+ # @api public
811
+ # @example
812
+ #
813
+ # input = { 'foo' => 'bar', 'baz' => [{ 'one' => 1 }] }
814
+ #
815
+ # t(:deep_symbolize_keys)[input]
816
+ # # => { :foo => "bar", :baz => [{ :one => 1 }] }
817
+ # @param [Hash]
818
+ # @return [Hash]
819
+ #
820
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#65
821
+ def deep_symbolize_keys(hash); end
822
+
823
+ # Recursively evaluate hash values if they are procs/lambdas
824
+ #
825
+ # @api public
826
+ # @example
827
+ # hash = {
828
+ # num: -> i { i + 1 },
829
+ # str: -> i { "num #{i}" }
830
+ # }
831
+ #
832
+ # t(:eval_values, 1)[hash]
833
+ # # => {:num => 2, :str => "num 1" }
834
+ #
835
+ # # with filters
836
+ # t(:eval_values, 1, [:str])[hash]
837
+ # # => {:num => #{still a proc}, :str => "num 1" }
838
+ # @param [Hash]
839
+ # @param args [Array, Object] Anything that should be passed to procs
840
+ # @param filters [Array] A list of attribute names that should be evaluated
841
+ #
842
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#380
843
+ def eval_values(hash, args, filters = T.unsafe(nil)); end
844
+
845
+ # Folds array of tuples to array of values from a specified key
846
+ #
847
+ # @api public
848
+ # @example
849
+ # source = {
850
+ # name: "Jane",
851
+ # tasks: [{ title: "be nice", priority: 1 }, { title: "sleep well" }]
852
+ # }
853
+ # Dry::Transformer(:fold, :tasks, :title)[source]
854
+ # # => { name: "Jane", tasks: ["be nice", "sleep well"] }
855
+ # Dry::Transformer(:fold, :tasks, :priority)[source]
856
+ # # => { name: "Jane", tasks: [1, nil] }
857
+ # @param hash [Hash]
858
+ # @param key [Object] The key to fold values to
859
+ # @param tuple_key [Object] The key to take folded values from
860
+ # @return [Hash]
861
+ #
862
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#315
863
+ def fold(hash, key, tuple_key); end
864
+
865
+ # Map all keys in a hash with the provided transformation function
866
+ #
867
+ # @api public
868
+ # @example
869
+ # Dry::Transformer(:map_keys, -> s { s.upcase })['name' => 'Jane']
870
+ # # => {"NAME" => "Jane"}
871
+ # @param [Hash]
872
+ # @return [Hash]
873
+ #
874
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#32
875
+ def map_keys(source_hash, fn); end
876
+
877
+ # Map a key in a hash with the provided transformation function
878
+ #
879
+ # @api public
880
+ # @example
881
+ # Dry::Transformer(:map_value, 'name', -> s { s.upcase })['name' => 'jane']
882
+ # # => {"name" => "JANE"}
883
+ # @param [Hash]
884
+ # @return [Hash]
885
+ #
886
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#223
887
+ def map_value(hash, key, fn); end
888
+
889
+ # Map all values in a hash using transformation function
890
+ #
891
+ # @api public
892
+ # @example
893
+ # Dry::Transformer(:map_values, -> v { v.upcase })[:name => 'Jane']
894
+ # # => {"name" => "JANE"}
895
+ # @param [Hash]
896
+ # @return [Hash]
897
+ #
898
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#136
899
+ def map_values(source_hash, fn); end
900
+
901
+ # Nest values from specified keys under a new key
902
+ #
903
+ # @api public
904
+ # @example
905
+ # Dry::Transformer(:nest, :address, [:street, :zipcode])[street: 'Street', zipcode: '123']
906
+ # # => {address: {street: "Street", zipcode: "123"}}
907
+ # @param [Hash]
908
+ # @return [Hash]
909
+ #
910
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#238
911
+ def nest(hash, root, keys); end
912
+
913
+ # Rejects specified keys from a hash
914
+ #
915
+ # @api public
916
+ # @example
917
+ # Dry::Transformer(:reject_keys, [:name])[name: 'Jane', email: 'jane@doe.org']
918
+ # # => {:email => "jane@doe.org"}
919
+ # @param hash [Hash] The input hash
920
+ # @param keys [Array] The keys to be rejected
921
+ # @return [Hash]
922
+ #
923
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#192
924
+ def reject_keys(hash, keys); end
925
+
926
+ # Rename all keys in a hash using provided mapping hash
927
+ #
928
+ # @api public
929
+ # @example
930
+ # Dry::Transformer(:rename_keys, user_name: :name)[user_name: 'Jane']
931
+ # # => {:name => "Jane"}
932
+ # @param source_hash [Hash] The input hash
933
+ # @param mapping [Hash] The key-rename mapping
934
+ # @return [Hash]
935
+ #
936
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#152
937
+ def rename_keys(source_hash, mapping); end
938
+
939
+ # Splits hash to array by all values from a specified key
940
+ #
941
+ # The operation adds missing keys extracted from the array to regularize the output.
942
+ #
943
+ # @api public
944
+ # @example
945
+ # input = {
946
+ # name: 'Joe',
947
+ # tasks: [
948
+ # { title: 'sleep well', priority: 1 },
949
+ # { title: 'be nice', priority: 2 },
950
+ # { priority: 2 },
951
+ # { title: 'be cool' }
952
+ # ]
953
+ # }
954
+ # Dry::Transformer(:split, :tasks, [:priority])[input]
955
+ # => [
956
+ # { name: 'Joe', priority: 1, tasks: [{ title: 'sleep well' }] },
957
+ # { name: 'Joe', priority: 2, tasks: [{ title: 'be nice' }, { title: nil }] },
958
+ # { name: 'Joe', priority: nil, tasks: [{ title: 'be cool' }] }
959
+ # ]
960
+ # @param hash [Hash]
961
+ # @param key [Object] The key to split a hash by
962
+ # @param subkeys [Array] The list of subkeys to be extracted from key
963
+ # @return [Array<Hash>]
964
+ #
965
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#347
966
+ def split(hash, key, keys); end
967
+
968
+ # Stringify all keys in a hash
969
+ #
970
+ # @api public
971
+ # @example
972
+ # Dry::Transformer(:stringify_keys)[:name => 'Jane']
973
+ # # => {"name" => "Jane"}
974
+ # @param [Hash]
975
+ # @return [Hash]
976
+ #
977
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#92
978
+ def stringify_keys(hash); end
979
+
980
+ # Symbolize all keys in a hash
981
+ #
982
+ # @api public
983
+ # @example
984
+ # Dry::Transformer(:symbolize_keys)['name' => 'Jane']
985
+ # # => {:name => "Jane"}
986
+ # @param [Hash]
987
+ # @return [Hash]
988
+ #
989
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#47
990
+ def symbolize_keys(hash); end
991
+
992
+ # Collapse a nested hash from a specified key
993
+ #
994
+ # @api public
995
+ # @example
996
+ # Dry::Transformer(:unwrap, :address, [:street, :zipcode])[address: { street: 'Street', zipcode: '123' }]
997
+ # # => {street: "Street", zipcode: "123"}
998
+ # @option options
999
+ # @param source_hash [Hash]
1000
+ # @param root [Mixed] The root key to unwrap values from
1001
+ # @param selected [Array] The keys that should be unwrapped (optional)
1002
+ # @param options [Hash] hash of options (optional)
1003
+ # @return [Hash]
1004
+ #
1005
+ # source://dry-transformer//lib/dry/transformer/hash_transformations.rb#276
1006
+ def unwrap(source_hash, root, selected = T.unsafe(nil), prefix: T.unsafe(nil)); end
1007
+ end
1008
+ end
1009
+
1010
+ # Pipe class for defining transprocs with a class DSL.
1011
+ #
1012
+ # @api public
1013
+ # @example
1014
+ # require 'anima'
1015
+ # require 'dry/transformer/all'
1016
+ #
1017
+ # class User
1018
+ # include Anima.new(:name, :address)
1019
+ # end
1020
+ #
1021
+ # class Address
1022
+ # include Anima.new(:city, :street, :zipcode)
1023
+ # end
1024
+ #
1025
+ # class UsersMapper < Dry::Transformer::Pipe
1026
+ # map_array do
1027
+ # symbolize_keys
1028
+ # rename_keys user_name: :name
1029
+ # nest :address, %i(city street zipcode)
1030
+ # map_value :address do
1031
+ # constructor_inject Address
1032
+ # end
1033
+ # constructor_inject User
1034
+ # end
1035
+ # end
1036
+ #
1037
+ # UsersMapper.new.call(
1038
+ # [
1039
+ # { 'user_name' => 'Jane',
1040
+ # 'city' => 'NYC',
1041
+ # 'street' => 'Street 1',
1042
+ # 'zipcode' => '123'
1043
+ # }
1044
+ # ]
1045
+ # )
1046
+ # # => [
1047
+ # #<User
1048
+ # name="Jane"
1049
+ # address=#<Address city="NYC" street="Street 1" zipcode="123">>
1050
+ # ]
1051
+ #
1052
+ # source://dry-transformer//lib/dry/transformer/pipe.rb#47
1053
+ class Dry::Transformer::Pipe
1054
+ extend ::Dry::Transformer::Pipe::ClassInterface
1055
+
1056
+ # Execute the transformation pipeline with the given input.
1057
+ #
1058
+ # @api public
1059
+ # @example
1060
+ #
1061
+ # class SymbolizeKeys < Dry::Transformer
1062
+ # symbolize_keys
1063
+ # end
1064
+ #
1065
+ # SymbolizeKeys.new.call('name' => 'Jane')
1066
+ # # => {:name=>"Jane"}
1067
+ # @param input [mixed] The input to pass to the pipeline
1068
+ # @return [mixed] output The output returned from the pipeline
1069
+ #
1070
+ # source://dry-transformer//lib/dry/transformer/pipe.rb#68
1071
+ def call(input); end
1072
+
1073
+ # @api public
1074
+ #
1075
+ # source://dry-transformer//lib/dry/transformer/pipe.rb#50
1076
+ def transproc; end
1077
+ end
1078
+
1079
+ # @api public
1080
+ #
1081
+ # source://dry-transformer//lib/dry/transformer/pipe/class_interface.rb#9
1082
+ module Dry::Transformer::Pipe::ClassInterface
1083
+ # Return a base Dry::Transformer class with the
1084
+ # container configured to the passed argument.
1085
+ #
1086
+ # @api public
1087
+ # @example
1088
+ #
1089
+ # class MyTransformer < Dry::Transformer[Transproc]
1090
+ # end
1091
+ # @param container [Transproc::Registry] The container to resolve transprocs from
1092
+ # @return [subclass of Dry::Transformer]
1093
+ #
1094
+ # source://dry-transformer//lib/dry/transformer/pipe/class_interface.rb#27
1095
+ def [](container); end
1096
+
1097
+ # Get or set the container to resolve transprocs from.
1098
+ #
1099
+ # @api private
1100
+ # @example
1101
+ #
1102
+ # # Setter
1103
+ # Dry::Transformer.container(Transproc)
1104
+ # # => Transproc
1105
+ #
1106
+ # # Getter
1107
+ # Dry::Transformer.container
1108
+ # # => Transproc
1109
+ # @param container [Transproc::Registry] The container to resolve transprocs from
1110
+ # @return [Transproc::Registry]
1111
+ #
1112
+ # source://dry-transformer//lib/dry/transformer/pipe/class_interface.rb#60
1113
+ def container(container = T.unsafe(nil)); end
1114
+
1115
+ # @api public
1116
+ #
1117
+ # source://dry-transformer//lib/dry/transformer/pipe/class_interface.rb#74
1118
+ def define!(&block); end
1119
+
1120
+ # @api private
1121
+ #
1122
+ # source://dry-transformer//lib/dry/transformer/pipe/class_interface.rb#11
1123
+ def dsl; end
1124
+
1125
+ # @api public
1126
+ #
1127
+ # source://dry-transformer//lib/dry/transformer/pipe/class_interface.rb#69
1128
+ def import(*args); end
1129
+
1130
+ # @api private
1131
+ #
1132
+ # source://dry-transformer//lib/dry/transformer/pipe/class_interface.rb#34
1133
+ def inherited(subclass); end
1134
+
1135
+ # @api public
1136
+ #
1137
+ # source://dry-transformer//lib/dry/transformer/pipe/class_interface.rb#81
1138
+ def new(*_arg0, **_arg1); end
1139
+
1140
+ # Get a transformation from the container,
1141
+ # without adding it to the transformation pipeline
1142
+ #
1143
+ # @api public
1144
+ # @example
1145
+ #
1146
+ # class Stringify < Dry::Transformer
1147
+ # map_values t(:to_string)
1148
+ # end
1149
+ #
1150
+ # Stringify.new.call(a: 1, b: 2)
1151
+ # # => {a: '1', b: '2'}
1152
+ # @param fn [Proc, Symbol] A proc, a name of the module's own function, or a name of imported
1153
+ # procedure from another module
1154
+ # @param args [Object, Array] Args to be carried by the transproc
1155
+ # @return [Transproc::Function]
1156
+ #
1157
+ # source://dry-transformer//lib/dry/transformer/pipe/class_interface.rb#109
1158
+ def t(fn, *args); end
1159
+ end
1160
+
1161
+ # @api public
1162
+ #
1163
+ # source://dry-transformer//lib/dry/transformer/pipe/dsl.rb#9
1164
+ class Dry::Transformer::Pipe::DSL
1165
+ # @api private
1166
+ # @return [DSL] a new instance of DSL
1167
+ #
1168
+ # source://dry-transformer//lib/dry/transformer/pipe/dsl.rb#17
1169
+ def initialize(container, ast: T.unsafe(nil), &block); end
1170
+
1171
+ # @api private
1172
+ #
1173
+ # source://dry-transformer//lib/dry/transformer/pipe/dsl.rb#14
1174
+ def ast; end
1175
+
1176
+ # @api private
1177
+ #
1178
+ # source://dry-transformer//lib/dry/transformer/pipe/dsl.rb#34
1179
+ def call(transformer); end
1180
+
1181
+ # @api private
1182
+ #
1183
+ # source://dry-transformer//lib/dry/transformer/pipe/dsl.rb#11
1184
+ def container; end
1185
+
1186
+ # @api private
1187
+ #
1188
+ # source://dry-transformer//lib/dry/transformer/pipe/dsl.rb#29
1189
+ def dup; end
1190
+
1191
+ # @api public
1192
+ #
1193
+ # source://dry-transformer//lib/dry/transformer/pipe/dsl.rb#24
1194
+ def t(name, *args); end
1195
+
1196
+ private
1197
+
1198
+ # @api private
1199
+ #
1200
+ # source://dry-transformer//lib/dry/transformer/pipe/dsl.rb#51
1201
+ def method_missing(meth, *args, &block); end
1202
+
1203
+ # @api private
1204
+ #
1205
+ # source://dry-transformer//lib/dry/transformer/pipe/dsl.rb#41
1206
+ def node(&block); end
1207
+
1208
+ # @api private
1209
+ # @return [Boolean]
1210
+ #
1211
+ # source://dry-transformer//lib/dry/transformer/pipe/dsl.rb#46
1212
+ def respond_to_missing?(method, _include_private = T.unsafe(nil)); end
1213
+ end
1214
+
1215
+ # Transformation functions for Procs
1216
+ #
1217
+ # @api public
1218
+ # @example
1219
+ # require 'ostruct'
1220
+ # require 'dry/transformer/proc'
1221
+ #
1222
+ # include Dry::Transformer::Helper
1223
+ #
1224
+ # fn = t(
1225
+ # :map_value,
1226
+ # 'foo_bar',
1227
+ # t(:bind, OpenStruct.new(prefix: 'foo'), -> s { [prefix, s].join('_') })
1228
+ # )
1229
+ #
1230
+ # fn["foo_bar" => "bar"]
1231
+ # # => {"foo_bar" => "foo_bar"}
1232
+ #
1233
+ # source://dry-transformer//lib/dry/transformer/proc_transformations.rb#23
1234
+ module Dry::Transformer::ProcTransformations
1235
+ extend ::Dry::Transformer::Registry
1236
+
1237
+ class << self
1238
+ # Change the binding for the given function
1239
+ #
1240
+ # @api public
1241
+ # @example
1242
+ # Dry::Transformer(
1243
+ # :bind,
1244
+ # OpenStruct.new(prefix: 'foo'),
1245
+ # -> s { [prefix, s].join('_') }
1246
+ # )['bar']
1247
+ # # => "foo_bar"
1248
+ # @param [Proc]
1249
+ # @return [Proc]
1250
+ #
1251
+ # source://dry-transformer//lib/dry/transformer/proc_transformations.rb#41
1252
+ def bind(value, binding, fn); end
1253
+ end
1254
+ end
1255
+
1256
+ # Recursive transformation functions
1257
+ #
1258
+ # @api public
1259
+ # @example
1260
+ # require 'dry/transformer/recursion'
1261
+ #
1262
+ # include Dry::Transformer::Helper
1263
+ #
1264
+ # fn = t(:hash_recursion, t(:symbolize_keys))
1265
+ #
1266
+ # fn["name" => "Jane", "address" => { "street" => "Street 1" }]
1267
+ # # => {:name=>"Jane", :address=>{:street=>"Street 1"}}
1268
+ #
1269
+ # source://dry-transformer//lib/dry/transformer/recursion.rb#18
1270
+ module Dry::Transformer::Recursion
1271
+ extend ::Dry::Transformer::Registry
1272
+
1273
+ class << self
1274
+ # Recursively apply the provided transformation function to an array
1275
+ #
1276
+ # @api public
1277
+ # @example
1278
+ # Dry::Transformer(:array_recursion, -> s { s.compact })[
1279
+ # [['Joe', 'Jane', nil], ['Smith', 'Doe', nil]]
1280
+ # ]
1281
+ # # => [["Joe", "Jane"], ["Smith", "Doe"]]
1282
+ # @param [Array]
1283
+ # @return [Array]
1284
+ #
1285
+ # source://dry-transformer//lib/dry/transformer/recursion.rb#85
1286
+ def array_recursion(value, fn); end
1287
+
1288
+ # Recursively apply the provided transformation function to a hash
1289
+ #
1290
+ # @api public
1291
+ # @example
1292
+ # Dry::Transformer(:hash_recursion, Dry::Transformer(:symbolize_keys))[
1293
+ # ["name" => "Jane", "address" => { "street" => "Street 1", "zipcode" => "123" }]
1294
+ # ]
1295
+ # # => {:name=>"Jane", :address=>{:street=>"Street 1", :zipcode=>"123"}}
1296
+ # @param [Hash]
1297
+ # @return [Hash]
1298
+ #
1299
+ # source://dry-transformer//lib/dry/transformer/recursion.rb#107
1300
+ def hash_recursion(value, fn); end
1301
+
1302
+ # Recursively apply the provided transformation function to an enumerable
1303
+ #
1304
+ # @api public
1305
+ # @example
1306
+ # Dry::Transformer(:recursion, Dry::Transformer(:is, ::Hash, Dry::Transformer(:symbolize_keys)))[
1307
+ # {
1308
+ # 'id' => 1,
1309
+ # 'name' => 'Jane',
1310
+ # 'tasks' => [
1311
+ # { 'id' => 1, 'description' => 'Write some code' },
1312
+ # { 'id' => 2, 'description' => 'Write some more code' }
1313
+ # ]
1314
+ # }
1315
+ # ]
1316
+ # => {
1317
+ # :id=>1,
1318
+ # :name=>"Jane",
1319
+ # :tasks=>[
1320
+ # {:id=>1, :description=>"Write some code"},
1321
+ # {:id=>2, :description=>"Write some more code"}
1322
+ # ]
1323
+ # }
1324
+ # @param [Enumerable]
1325
+ # @return [Enumerable]
1326
+ #
1327
+ # source://dry-transformer//lib/dry/transformer/recursion.rb#54
1328
+ def recursion(value, fn); end
1329
+ end
1330
+ end
1331
+
1332
+ # @api public
1333
+ #
1334
+ # source://dry-transformer//lib/dry/transformer/recursion.rb#23
1335
+ Dry::Transformer::Recursion::IF_ARRAY = T.let(T.unsafe(nil), Proc)
1336
+
1337
+ # @api public
1338
+ #
1339
+ # source://dry-transformer//lib/dry/transformer/recursion.rb#21
1340
+ Dry::Transformer::Recursion::IF_ENUMERABLE = T.let(T.unsafe(nil), Proc)
1341
+
1342
+ # @api public
1343
+ #
1344
+ # source://dry-transformer//lib/dry/transformer/recursion.rb#25
1345
+ Dry::Transformer::Recursion::IF_HASH = T.let(T.unsafe(nil), Proc)
1346
+
1347
+ # Container to define transproc functions in, and access them via `[]` method
1348
+ # from the outside of the module
1349
+ #
1350
+ # @api public
1351
+ # @example
1352
+ # module FooMethods
1353
+ # extend Dry::Transformer::Registry
1354
+ #
1355
+ # def self.foo(name, prefix)
1356
+ # [prefix, '_', name].join
1357
+ # end
1358
+ # end
1359
+ #
1360
+ # fn = FooMethods[:foo, 'baz']
1361
+ # fn['qux'] # => 'qux_baz'
1362
+ #
1363
+ # module BarMethods
1364
+ # extend FooMethods
1365
+ #
1366
+ # def self.bar(*args)
1367
+ # foo(*args).upcase
1368
+ # end
1369
+ # end
1370
+ #
1371
+ # fn = BarMethods[:foo, 'baz']
1372
+ # fn['qux'] # => 'qux_baz'
1373
+ #
1374
+ # fn = BarMethods[:bar, 'baz']
1375
+ # fn['qux'] # => 'QUX_BAZ'
1376
+ #
1377
+ # source://dry-transformer//lib/dry/transformer/registry.rb#35
1378
+ module Dry::Transformer::Registry
1379
+ # Builds the transformation
1380
+ #
1381
+ # @api public
1382
+ # @param fn [Proc, Symbol] A proc, a name of the module's own function, or a name of imported
1383
+ # procedure from another module
1384
+ # @param args [Object, Array] Args to be carried by the transproc
1385
+ # @return [Dry::Transformer::Function]
1386
+ #
1387
+ # source://dry-transformer//lib/dry/transformer/registry.rb#48
1388
+ def [](fn, *args); end
1389
+
1390
+ # Returns wether the registry contains such transformation by its key
1391
+ #
1392
+ # @api public
1393
+ # @param key [Symbol]
1394
+ # @return [Boolean]
1395
+ #
1396
+ # source://dry-transformer//lib/dry/transformer/registry.rb#63
1397
+ def contain?(key); end
1398
+
1399
+ # Gets the procedure for creating a transproc
1400
+ #
1401
+ # @api public
1402
+ # @param fn [#call, Symbol] Either the procedure, or the name of the method of the current module,
1403
+ # or the registered key of imported procedure in a store.
1404
+ # @return [#call]
1405
+ #
1406
+ # source://dry-transformer//lib/dry/transformer/registry.rb#134
1407
+ def fetch(fn); end
1408
+
1409
+ # Imports either a method (converted to a proc) from another module, or
1410
+ # all methods from that module.
1411
+ #
1412
+ # If the external module is a registry, looks for its imports too.
1413
+ #
1414
+ # @api public
1415
+ # @overload import
1416
+ # @overload import
1417
+ # @overload import
1418
+ # @return [itself] self
1419
+ #
1420
+ # source://dry-transformer//lib/dry/transformer/registry.rb#112
1421
+ def import(*args); end
1422
+
1423
+ # store.register(:to_json) { |v| v.to_json }
1424
+ #
1425
+ # @api public
1426
+ #
1427
+ # source://dry-transformer//lib/dry/transformer/registry.rb#74
1428
+ def register(name, fn = T.unsafe(nil), &block); end
1429
+
1430
+ # The store of procedures imported from external modules
1431
+ #
1432
+ # @api public
1433
+ # @return [Dry::Transformer::Store]
1434
+ #
1435
+ # source://dry-transformer//lib/dry/transformer/registry.rb#122
1436
+ def store; end
1437
+
1438
+ # Builds the transformation
1439
+ #
1440
+ # @api public
1441
+ # @param fn [Proc, Symbol] A proc, a name of the module's own function, or a name of imported
1442
+ # procedure from another module
1443
+ # @param args [Object, Array] Args to be carried by the transproc
1444
+ # @return [Dry::Transformer::Function]
1445
+ #
1446
+ # source://dry-transformer//lib/dry/transformer/registry.rb#48
1447
+ def t(fn, *args); end
1448
+
1449
+ # Imports either a method (converted to a proc) from another module, or
1450
+ # all methods from that module.
1451
+ #
1452
+ # If the external module is a registry, looks for its imports too.
1453
+ #
1454
+ # @api public
1455
+ # @overload import
1456
+ # @overload import
1457
+ # @overload import
1458
+ # @return [itself] self
1459
+ #
1460
+ # source://dry-transformer//lib/dry/transformer/registry.rb#112
1461
+ def uses(*args); end
1462
+
1463
+ private
1464
+
1465
+ # @api private
1466
+ # @return [Boolean]
1467
+ #
1468
+ # source://dry-transformer//lib/dry/transformer/registry.rb#145
1469
+ def already_wrapped?(func); end
1470
+ end
1471
+
1472
+ # Immutable collection of named procedures from external modules
1473
+ #
1474
+ # @api private
1475
+ #
1476
+ # source://dry-transformer//lib/dry/transformer/store.rb#9
1477
+ class Dry::Transformer::Store
1478
+ # source://dry-transformer//lib/dry/transformer/store.rb#25
1479
+ def initialize(methods = T.unsafe(nil)); end
1480
+
1481
+ # source://dry-transformer//lib/dry/transformer/store.rb#46
1482
+ def contain?(key); end
1483
+
1484
+ # source://dry-transformer//lib/dry/transformer/store.rb#36
1485
+ def fetch(key); end
1486
+
1487
+ # source://dry-transformer//lib/dry/transformer/store.rb#65
1488
+ def import(*args); end
1489
+
1490
+ # @api private
1491
+ # @return [Hash] The associated list of imported procedures
1492
+ #
1493
+ # source://dry-transformer//lib/dry/transformer/store.rb#14
1494
+ def methods; end
1495
+
1496
+ # source://dry-transformer//lib/dry/transformer/store.rb#57
1497
+ def register(name, fn = T.unsafe(nil), &block); end
1498
+
1499
+ protected
1500
+
1501
+ # source://dry-transformer//lib/dry/transformer/store.rb#119
1502
+ def import_all(source); end
1503
+
1504
+ # source://dry-transformer//lib/dry/transformer/store.rb#90
1505
+ def import_method(source, name, new_name = T.unsafe(nil)); end
1506
+
1507
+ # source://dry-transformer//lib/dry/transformer/store.rb#107
1508
+ def import_methods(source, names); end
1509
+ end
1510
+
1511
+ # source://dry-transformer//lib/dry/transformer/constants.rb#5
1512
+ Dry::Transformer::Undefined = T.let(T.unsafe(nil), Object)