json_refs 0.1.5 → 0.1.6

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: afda1a9f8de85cb20c9baadba689f01b21a664a16d5c47e405c3c2dffc7f8203
4
- data.tar.gz: db450eb89016442f61af6325fc7f66dc1e642bb70420a087277d5172025469ac
3
+ metadata.gz: 873527fb07ff698ff5cae1f2954cf403e876c2e6353fb5a395e7eab5517dd08a
4
+ data.tar.gz: d9d3c3a6b2493f1150c29a1834b72a474089690e0aab0ad4d6e32670dfa55e74
5
5
  SHA512:
6
- metadata.gz: c90414cb7617ebf433c1a05079600032f692136bcca25ae3388b21ff27c8764750cdcf82d69f300d159fef97f629b1147de36c81d84334735c8af20df8643deb
7
- data.tar.gz: 02c43b3dc1aa1737050b863b591b7c03d4acf9f8ef54885643cfe2d19c4aa37d11e77422a7baf047bda8db83dc46d9e77101417a90b6ab32eff12c95256fd8ac
6
+ metadata.gz: f1ef5cb22467df59eb10e0a0f4bdc5fbdcae6e6260f7d8f59a26b34447b325a8d2bb4bec2c31715c997c99a2e071c6669692fc3f8620c9495915a740cd191a4e
7
+ data.tar.gz: 719c2b6dd54023a0f788d30ddc3caa0526bff1c3f80bfa6c1f395b399cd11f8d77563283c03c2da42802abf49e8ca50eec602709498ee2fd95b9d3da9c718764
@@ -48,11 +48,17 @@ module JsonRefs
48
48
  puts "De-referencing #{referenced_path}"
49
49
  end
50
50
 
51
- if referenced_path =~ /^#/
52
- dereference_local(referenced_path)
53
- else
54
- dereference_file(referenced_path)
55
- end
51
+ filepath, pointer = referenced_path.split('#')
52
+ pointer.prepend('#') if pointer
53
+ return dereference_local(pointer) if filepath.empty?
54
+
55
+ dereferenced_file = dereference_file(filepath)
56
+ return dereferenced_file if pointer.nil?
57
+
58
+ JsonRefs::DereferenceHandler::Local.new(
59
+ doc: dereferenced_file,
60
+ path: pointer
61
+ ).call
56
62
  end
57
63
 
58
64
  def dereference_local(referenced_path)
@@ -84,7 +90,7 @@ module JsonRefs
84
90
  def recursive_dereference(referenced_path, klass)
85
91
  directory = File.dirname(referenced_path)
86
92
  filename = File.basename(referenced_path)
87
-
93
+
88
94
  dereferenced_doc = {}
89
95
  Dir.chdir(directory) do
90
96
  referenced_doc = klass.new(path: filename, doc: @doc).call
@@ -1,3 +1,3 @@
1
1
  module JsonRefs
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_refs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Makoto Tajitsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-04 00:00:00.000000000 Z
11
+ date: 2020-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hana