schema-model 0.6.9 → 0.6.10

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: 991632c4e13a6020fa51c75785cbf9cf3549a2628e8482fd55f6118ad5a22d90
4
- data.tar.gz: 82a9b70b1e99ef72884528f7413b63b18224c1e613e0f561e74c1207dd8cd21b
3
+ metadata.gz: 9f8ccd138c2e52700656fe5bcf67ba518cdfb4c756cf656f821928758872c795
4
+ data.tar.gz: 90f75db3fc2e4fbae2bf350894b973cea392e652ca0be9b81368f0e9195f6c4b
5
5
  SHA512:
6
- metadata.gz: c96de3ffd4bcbac6669dcce6f125a042cd36d0f079ca586280ab89d94bca54becef85e822246fedd08c48bae9fb5d4b882d4858cbc275dbd0910d7c9b23d8c4b
7
- data.tar.gz: 235d1e221a1f7aeeef723a143c5b0f3abc49a7f526622a449120f9c4ad020bba928bda92933416d1db61388fc06a6c8d25571de4bc4c20e8cdc436839acb4ff5
6
+ metadata.gz: ed515074d1a4ec263196f6217c9917f03dadb24dd6dc0b116168198b0c78e73c2cb18f268ed23ea19997d3d06a7fc46b269a51bd42b4e33c38325be0226b86d1
7
+ data.tar.gz: 58ccd5d4e9902f0dfff14e92222dcb2a6095cbd5bf281004ca738bdbc33618c38c300f76115d25ca91749d3d8b08cd4ec3548c0eb1fdeb43eabb0494b893055e
@@ -48,6 +48,21 @@ module Schema
48
48
  end
49
49
  end
50
50
 
51
+ # if the string is empty return nil
52
+ def parse_string_or_nil(field_name, parsing_errors, value)
53
+ case value
54
+ when String
55
+ value.empty? ? nil : value
56
+ when ::Hash, ::Array
57
+ parsing_errors.add(field_name, ::Schema::ParsingErrors::INCOMPATABLE)
58
+ nil
59
+ when nil
60
+ nil
61
+ else
62
+ String(value)
63
+ end
64
+ end
65
+
51
66
  def parse_float(field_name, parsing_errors, value)
52
67
  case value
53
68
  when Float
@@ -118,7 +133,7 @@ module Schema
118
133
  when Integer, Float
119
134
  value != 0
120
135
  when String
121
- BOOLEAN_REGEX.match(value)
136
+ BOOLEAN_REGEX.match?(value)
122
137
  when nil
123
138
  nil
124
139
  else
data/schema-model.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'schema-model'
5
- s.version = '0.6.9'
5
+ s.version = '0.6.10'
6
6
  s.licenses = ['MIT']
7
7
  s.summary = 'Schema Model'
8
8
  s.description = 'Easy way to create models from payloads'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.9
4
+ version: 0.6.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-04 00:00:00.000000000 Z
11
+ date: 2023-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inheritance-helper