nakischema 0.1.3 → 0.1.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
  SHA1:
3
- metadata.gz: f12dd71c0e349bb4c32d404317b64e8f4bfe2d4c
4
- data.tar.gz: 56ade8e30f239f41d315b6aefa2bef82e434a605
3
+ metadata.gz: 271b63150c8a6eead2fba711f312b2e2f82ba24a
4
+ data.tar.gz: 829b656fc7a75c629d3ccea2ac44ca4de98d4598
5
5
  SHA512:
6
- metadata.gz: b32ad0bd582d777c3a8cf03878b359d95278e0690625a4c6184bf26fff4050e60e972539270799a6927f6dc609d18c3edd63cbf92653b01f4f2f387dff973951
7
- data.tar.gz: a014ed22afe9721d23b70eefe0a012188d001db8f8fe179be2c9b0d5557a3e3aa15d5d813ebe78e603cefeb72787c5efb9baf1b17dfc2bd916d6cf7d8c4c95c4
6
+ metadata.gz: 07bd982a7331b8ec0937b97d682b623d4c85ac14bcb71512dc85bc16536f40f8a01dfcac0df379097614f84748a93d2d426c2addb45b0f0ca703ee1b0c069ef6
7
+ data.tar.gz: c2716c3ad3e8e804891ef364c31ca7ffc3a2289b16a32f203905362b866bc3f832932be3a0350c25edd41b60d7d22c3b1739d2e279aebd0f1987d76655e07ee2
data/lib/nakischema.rb CHANGED
@@ -96,12 +96,12 @@ module Nakischema
96
96
  when :exact ; children = object.xpath "./*"
97
97
  names = children.map(&:name).uniq
98
98
  raise_with_path.call "expected implicit children #{v.keys} != #{names}" unless v.keys == names
99
- v.each do |k, v|
100
- selected = children.select{ |_| _.name == k }
101
- validate_oga_xml selected, v, [*path, k]
102
- end
103
- when :children ; v.each{ |k, v| validate_oga_xml object.xpath(k.start_with?("./") ? k : "./#{k}"), v, [*path, k] }
104
- when :attr_req ; v.each{ |k, v| validate_oga_xml object[k], v, [*path, k] }
99
+ v.each{ |k, v| validate_oga_xml children.select{ |_| _.name == k }, v, [*path, k] }
100
+ when :children ; v.each{ |k, v| validate_oga_xml object.xpath(k.start_with?("./") ? k : "./#{k}"), v, [*path, k] }
101
+ when :attr_exact ; names = object.attributes.map &:name
102
+ raise_with_path.call "expected implicit attributes #{v.keys} != #{names}" unless v.keys == names
103
+ v.each{ |k, v| validate_oga_xml object[k], v, [*path, k] }
104
+ when :attr_req ; v.each{ |k, v| validate_oga_xml object[k], v, [*path, k] }
105
105
  when :assertions
106
106
  v.each_with_index do |assertion, i|
107
107
  begin
data/nakischema.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "nakischema"
3
- spec.version = "0.1.3"
3
+ spec.version = "0.1.4"
4
4
  spec.summary = "compact yet powerful arbitrary nested objects validator"
5
5
  spec.description = "The most compact yet powerful arbitrary nested objects validator. Especially handy to validate JSONs."
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nakischema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Maslov aka Nakilon