pupa 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07c621bf45737244947d412e6282581a49c63dac
4
- data.tar.gz: 0844ac4046529df46e52a3d48376fc49c5fa39e4
3
+ metadata.gz: 77d431c205df726539ae647437d320f79bf4a2c6
4
+ data.tar.gz: 9a8ab849b2865d4211d86cb6b7e86fe959e8edde
5
5
  SHA512:
6
- metadata.gz: 4a1e4d54ae62fc327454cc54ce9ce8eb0a2f9cccc716a0001d38e526f7030a900149dbda72ff967bcaa38857ecd2621429fb67f57007f148c9b08c5f3f724ef7
7
- data.tar.gz: 4059e6c7c8e5f7c6927fc3f7b9ea11b7d6f5a8139e2bb3546a84b06641fad60014d0ca65adc1188a8e748191f67cfc0fdd88020aa2f88cfd7b4984f629abffb5
6
+ metadata.gz: 0c43992f870cd679e8b4ede85413d871b3018d4e30cb6d55c0e4eb208099bfadf7febaaf1a54bbedc19ea7baa470877de74516aaa49a09c738dcb8e75dce7390
7
+ data.tar.gz: f885fb7ffee30f5be495bd02cced6423494055a0b7c2a4b6ff1ca5eb8dbc97436a7d21be42039ec6d20a20e606445d1c1379b75ee5bcb31d818fbe0dd456a2bf
@@ -4,6 +4,7 @@ require 'set'
4
4
 
5
5
  require 'active_support/callbacks'
6
6
  require 'active_support/core_ext/hash/except'
7
+ require 'active_support/core_ext/hash/keys'
7
8
  require 'active_support/core_ext/hash/slice'
8
9
  require 'active_support/core_ext/object/try'
9
10
  require 'json-schema'
@@ -150,12 +151,8 @@ module Pupa
150
151
  # @raises [JSON::Schema::ValidationError] if the object is invalid
151
152
  def validate!
152
153
  if self.class.json_schema
153
- result = {}
154
- to_h.each do |key,value|
155
- result[key.to_s] = value
156
- end
157
154
  # JSON::Validator#initialize_data runs fastest if given a hash.
158
- JSON::Validator.validate!(self.class.json_schema, result)
155
+ JSON::Validator.validate!(self.class.json_schema, to_h.deep_stringify_keys)
159
156
  end
160
157
  end
161
158
 
@@ -1,6 +1,8 @@
1
1
  module Pupa
2
2
  class Refinements
3
- # A refinement for JSON Schema to validate "email" and "uri" formats.
3
+ # A refinement for JSON Schema to validate "email" and "uri" formats. Using
4
+ # Ruby's refinements doesn't seem to work, possibly because `refine` can't
5
+ # be used with `prepend`.
4
6
  module Format
5
7
  # @see http://my.rails-royce.org/2010/07/21/email-validation-in-ruby-on-rails-without-regexp/
6
8
  def validate(current_schema, data, fragments, processor, validator, options = {})
data/lib/pupa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pupa
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pupa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Open North