json_schemer 0.2.4 → 0.2.5

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: a8a183671565c8bc3443ea0cb0b729858c4c34208c45da986bc2994504d1dfa3
4
- data.tar.gz: dc7005acad88d864d4c7a5781fb0fd9d3e5ec7f78cd152db0cad9591ce650eb5
3
+ metadata.gz: dd79033e749c1e3077636935feed34452d51b528b89acef5e35d07871f6ab9c0
4
+ data.tar.gz: 355a3bb6aae3ea6c29047c69d0f64d3481bfa265453b6a495788d4a963715abd
5
5
  SHA512:
6
- metadata.gz: b5c165cb49f7fb1e0d2253542a0b5d14bf6c624d474fea09ec3e1727ae0f443f74242b423c4f4478b61cb648654e87e7e52dca458792ae4bc771705a2efb999b
7
- data.tar.gz: 6e507392188f78799924393b992eb646933fa9ce046b527d89bd368d7e24691d98e2fb4c6286e57e66ff25f6cfc775c5f09a76184433cdfe479ae1681f522ee3
6
+ metadata.gz: fce9c0f1ceb00466f7da2a1692fb1fb78382c5d82f8bc6995bb81af0c6a1f362e5602b2574fbe4429e661b29c89f6af16cf8871cba8893f5439c1a5079126887
7
+ data.tar.gz: fdc5f5968f05fa551939c22c0dfe66226e2cec18bcdc53aa567287b89b1fc00f8599d8cb5a3e8a19c2822ebe6601aea47a0a9b97a82529f3a1fb3e0c601c9673
@@ -4,10 +4,6 @@ rvm:
4
4
  - 2.6
5
5
  - 2.5
6
6
  - 2.4
7
- - 2.3
8
- - 2.2
9
- - 2.1
10
- - 2.0
11
7
  before_install: gem install bundler -v 1.16.1
12
8
  before_script:
13
9
  - pip install --user Flask
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- json_schemer (0.2.4)
4
+ json_schemer (0.2.5)
5
5
  ecma-re-validator (~> 0.2)
6
6
  hana (~> 1.3)
7
7
  regexp_parser (~> 1.5)
@@ -22,10 +22,10 @@ PLATFORMS
22
22
  ruby
23
23
 
24
24
  DEPENDENCIES
25
- bundler (~> 1.16)
25
+ bundler (~> 2.0)
26
26
  json_schemer!
27
27
  minitest (~> 5.0)
28
28
  rake (~> 10.0)
29
29
 
30
30
  BUNDLED WITH
31
- 1.17.3
31
+ 2.0.2
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.required_ruby_version = '~> 2.0'
23
+ spec.required_ruby_version = '~> 2.4'
24
24
 
25
- spec.add_development_dependency "bundler", "~> 1.16"
25
+ spec.add_development_dependency "bundler", "~> 2.0"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "minitest", "~> 5.0"
28
28
 
@@ -108,18 +108,18 @@ module JSONSchemer
108
108
 
109
109
  def valid_date_time?(data)
110
110
  DateTime.rfc3339(data)
111
- !!(DATE_TIME_OFFSET_REGEX =~ data)
111
+ DATE_TIME_OFFSET_REGEX.match?(data)
112
112
  rescue ArgumentError => e
113
113
  raise e unless e.message == 'invalid date'
114
114
  false
115
115
  end
116
116
 
117
117
  def valid_email?(data)
118
- !!(EMAIL_REGEX =~ data)
118
+ EMAIL_REGEX.match?(data)
119
119
  end
120
120
 
121
121
  def valid_hostname?(data)
122
- !!(HOSTNAME_REGEX =~ data && data.split('.').all? { |label| label.size <= 63 })
122
+ HOSTNAME_REGEX.match?(data) && data.split('.').all? { |label| label.size <= 63 }
123
123
  end
124
124
 
125
125
  def valid_ip?(data, type)
@@ -130,11 +130,11 @@ module JSONSchemer
130
130
  end
131
131
 
132
132
  def valid_iri?(data)
133
- !!(IRI =~ data)
133
+ IRI.match?(data)
134
134
  end
135
135
 
136
136
  def valid_iri_reference?(data)
137
- !!(IRELATIVE_REF =~ data)
137
+ IRELATIVE_REF.match?(data)
138
138
  end
139
139
 
140
140
  def valid_uri_template?(data)
@@ -145,11 +145,11 @@ module JSONSchemer
145
145
  end
146
146
 
147
147
  def valid_json_pointer?(data)
148
- !!(JSON_POINTER_REGEX =~ data)
148
+ JSON_POINTER_REGEX.match?(data)
149
149
  end
150
150
 
151
151
  def valid_relative_json_pointer?(data)
152
- !!(RELATIVE_JSON_POINTER_REGEX =~ data)
152
+ RELATIVE_JSON_POINTER_REGEX.match?(data)
153
153
  end
154
154
  end
155
155
  end
@@ -470,13 +470,7 @@ module JSONSchemer
470
470
  if insert_property_defaults?
471
471
  properties.each do |property, property_schema|
472
472
  if !data.key?(property) && property_schema.key?('default')
473
- default = property_schema.fetch('default')
474
- data[property] = case default
475
- when Numeric, Symbol, true, false, nil
476
- default
477
- else
478
- default.clone
479
- end
473
+ data[property] = property_schema.fetch('default').clone
480
474
  end
481
475
  end
482
476
  end
@@ -526,7 +520,7 @@ module JSONSchemer
526
520
  [pattern, ecma_262_regex(pattern), property_schema]
527
521
  end
528
522
  regex_pattern_properties.each do |pattern, regex, property_schema|
529
- if regex =~ key
523
+ if regex.match?(key)
530
524
  subinstance = instance.merge(
531
525
  data: value,
532
526
  data_pointer: "#{instance.data_pointer}/#{key}",
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module JSONSchemer
3
- VERSION = '0.2.4'
3
+ VERSION = '0.2.5'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_schemer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Harsha
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -146,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
146
  requirements:
147
147
  - - "~>"
148
148
  - !ruby/object:Gem::Version
149
- version: '2.0'
149
+ version: '2.4'
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - ">="