servactory 2.0.3 → 2.0.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: d4c3af571fde0fe1cc117e71ed04c7b13ab3d212f5524ad684382e905462fc8d
4
- data.tar.gz: 95c2ad162f85d874eb250aa1db1104e8aae685e1f738ea9b37d94f19ebc6c92a
3
+ metadata.gz: 1f3edad8d15393a6541eee430383fcd03da3ddf339bf6215ddf95d391487dde6
4
+ data.tar.gz: 7143c15722e8d1183f523126dbf265315f182588b193f233a6f140612c532af0
5
5
  SHA512:
6
- metadata.gz: 4a1385bd8a58e5931523772619812f53168593ab5135b2c9e92f6eda4ed90097a37bd7665e56669fca6e99303d406ad9ebe68684713f63ed0b8c530cf7f5bfb9
7
- data.tar.gz: a720e57fece727a1374802a6b419c40eca107be60325a7282aa34559b9b6e519f8891f210c0c2185ea614c70b343b881803c24a5662dc9c863100f3a2cefdb22
6
+ metadata.gz: 0f2f96d3707a5ea5787a837e90e4c3a45ccf0464499525259e357d918ea6173b3e4318ff1f3fc70841f04bfbc2971e2f66fd378bdaf733d82e0237b5dff242ad
7
+ data.tar.gz: 5aae275ca976e9a4b5d3db1bec44e2a9bcfac18ef53c7b6e6fbd15a874d89970d066073eea09369d80bacc0ce81d6a6190883178d58c92b9965def62f3be809f
@@ -7,8 +7,9 @@ module Servactory
7
7
  RESERVED_ATTRIBUTES = %i[type required default].freeze
8
8
  private_constant :RESERVED_ATTRIBUTES
9
9
 
10
- def initialize(context:, collection_of_inputs:)
10
+ def initialize(context:, incoming_arguments:, collection_of_inputs:)
11
11
  @context = context
12
+ @incoming_arguments = incoming_arguments
12
13
  @collection_of_inputs = collection_of_inputs
13
14
  end
14
15
 
@@ -47,19 +48,20 @@ module Servactory
47
48
 
48
49
  return yield if input.nil?
49
50
 
50
- input.value = input.default if input.optional? && input.value.blank?
51
+ input_value = @incoming_arguments.fetch(input.name, nil)
52
+ input_value = input.default if input.optional? && input_value.blank?
51
53
 
52
54
  if input.hash_mode? && (tmp_schema = input.schema.fetch(:is)).present?
53
- input.value = prepare_hash_values_inside(object: input.value, schema: tmp_schema)
55
+ input_value = prepare_hash_values_inside(object: input_value, schema: tmp_schema)
54
56
  end
55
57
 
56
58
  input_prepare = input.prepare.fetch(:in, nil)
57
- input.value = input_prepare.call(value: input.value) if input_prepare.present?
59
+ input_value = input_prepare.call(value: input_value) if input_prepare.present?
58
60
 
59
61
  if name.to_s.end_with?("?")
60
- Servactory::Utils.query_attribute(input.value)
62
+ Servactory::Utils.query_attribute(input_value)
61
63
  else
62
- input.value
64
+ input_value
63
65
  end
64
66
  end
65
67
  # rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Lint/UnusedMethodArgument
@@ -6,6 +6,7 @@ module Servactory
6
6
  def inputs
7
7
  @inputs ||= Inputs.new(
8
8
  context: self,
9
+ incoming_arguments: incoming_arguments,
9
10
  collection_of_inputs: collection_of_inputs
10
11
  )
11
12
  end
@@ -4,7 +4,7 @@ module Servactory
4
4
  module VERSION
5
5
  MAJOR = 2
6
6
  MINOR = 0
7
- PATCH = 3
7
+ PATCH = 4
8
8
  PRE = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-16 00:00:00.000000000 Z
11
+ date: 2023-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -319,7 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
319
319
  - !ruby/object:Gem::Version
320
320
  version: '0'
321
321
  requirements: []
322
- rubygems_version: 3.4.17
322
+ rubygems_version: 3.5.1
323
323
  signing_key:
324
324
  specification_version: 4
325
325
  summary: A set of tools for building reliable services of any complexity