json-schema_builder 0.2.0 → 0.2.1

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: 81bbd02201c3857389c10b1fb7b2646da0876826
4
- data.tar.gz: 0d3d2b317e2c95e1949c11b2541e9018ad1f3611
3
+ metadata.gz: b9d8f8342dec85f473fec720fefb55c0a584e6b7
4
+ data.tar.gz: 60d64252fd465336fda5a32b012860002e658c7b
5
5
  SHA512:
6
- metadata.gz: 64c161e632998919d104674c86a26095a20cdeb98f18031015efeb4fce44fc5f15dab9727e5621732b015a3c85ad97e7204f9f3713b7b0aa8102668cadbf836c
7
- data.tar.gz: 8d6127dda6fbca78783ed2b42ab7d58fbe5a7bde5d75b86b4601b38e3091089118e4ea6c6510e46c900f5ac3c8c6e69ae0c4a8861e31809f00111320c563012f
6
+ metadata.gz: 15c9cb066c9fc51ff075d9c77142e7a43c9f04f25cade97e4864d3672deb4e9b0da57bbb57856daa9766ad1e281766d75ec4a48a5a408a6cf9c4f2827fbef600
7
+ data.tar.gz: 302be39bebe17e01cc5b14af72c6e0ac3483ceb680f3ace8405ed36c14b734af538bfa2c9a020df8258e2f3c69bcc434389003ba442c744831ff8264af35ba6f
@@ -4,11 +4,11 @@ module JSON
4
4
  module SchemaBuilder
5
5
  class Schema < OpenStruct
6
6
  def merge(schema)
7
- self.class.new to_h.deep_merge schema.to_h
7
+ self.class.new to_h.deep_stringify_keys.deep_merge(schema.to_h.deep_stringify_keys)
8
8
  end
9
9
 
10
10
  def merge!(schema)
11
- @table = to_h.deep_merge schema.to_h
11
+ @table = to_h.deep_stringify_keys.deep_merge schema.to_h.deep_stringify_keys
12
12
  self
13
13
  end
14
14
  end
@@ -1,5 +1,5 @@
1
1
  module JSON
2
2
  module SchemaBuilder
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
@@ -2,14 +2,14 @@ require 'spec_helper'
2
2
 
3
3
  RSpec.describe JSON::SchemaBuilder::Schema, type: :unit do
4
4
  let(:schema){ described_class.new a: 1, b: { c: 3 } }
5
- let(:other){ described_class.new a: 2, b: { d: 4 } }
5
+ let(:other){ described_class.new a: 2, "b" => { d: 4 } }
6
6
  it{ is_expected.to be_a OpenStruct }
7
7
 
8
8
  describe '#merge' do
9
9
  it 'should deep merge' do
10
10
  merged = schema.merge other
11
11
  expect(merged).to be_a described_class
12
- expect(merged.to_h).to eql a: 2, b: { c: 3, d: 4 }
12
+ expect(merged.to_h).to eql a: 2, b: { "c" => 3, "d" => 4 }
13
13
  end
14
14
 
15
15
  it 'should not modify the source schema' do
@@ -25,7 +25,7 @@ RSpec.describe JSON::SchemaBuilder::Schema, type: :unit do
25
25
  it 'should deep merge in place' do
26
26
  merged = schema.merge! other
27
27
  expect(merged).to be_a described_class
28
- expect(merged.to_h).to eql a: 2, b: { c: 3, d: 4 }
28
+ expect(merged.to_h).to eql "a" => 2, "b" => { "c" => 3, "d" => 4 }
29
29
  end
30
30
 
31
31
  it 'should not modify the merging schema' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-schema_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Parrish
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-06 00:00:00.000000000 Z
11
+ date: 2017-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler