json_refs 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 +4 -4
- data/.travis.yml +10 -3
- data/json_refs.gemspec +1 -1
- data/lib/json_refs.rb +6 -2
- data/lib/json_refs/loader.rb +11 -2
- data/lib/json_refs/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a29f7d08b06e1f2ed82294615bc8ddbbe19d7f1ae851e1107867f2c6bce4fc7
|
4
|
+
data.tar.gz: f70a24246a51dbdcb63ebd9904dd80503632b464a3dcbae403d1a2686fd72b30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f67907c9f0da4a3e35eaed6a204d7846502a61c9fefa202b99d88ca2245ffe6a576585d4dbd32a748f7a7e8c7258636834e69167247eb7027e6067b71318e0b
|
7
|
+
data.tar.gz: 35d3f1cd8176b06e2c7abaf074d440de1257c64d0c5e0ac535ee594c9de9dacf8274c232cb1196c03cdfd0e7f3f5af467f5b93adfdf1edca03c75a942d696417
|
data/.travis.yml
CHANGED
data/json_refs.gemspec
CHANGED
@@ -24,6 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency "hana"
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 2.0"
|
27
|
-
spec.add_development_dependency "rake", "
|
27
|
+
spec.add_development_dependency "rake", ">= 10.0"
|
28
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
29
|
end
|
data/lib/json_refs.rb
CHANGED
@@ -2,8 +2,12 @@ require 'json_refs/version'
|
|
2
2
|
require 'json_refs/dereference_handler'
|
3
3
|
|
4
4
|
module JsonRefs
|
5
|
-
|
6
|
-
|
5
|
+
class << self
|
6
|
+
def call(doc, options = {})
|
7
|
+
Dereferencer.new(doc, options).call
|
8
|
+
end
|
9
|
+
|
10
|
+
alias_method :dereference, :call
|
7
11
|
end
|
8
12
|
|
9
13
|
class Dereferencer
|
data/lib/json_refs/loader.rb
CHANGED
@@ -27,8 +27,7 @@ module JsonRefs
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def handle(filename)
|
30
|
-
|
31
|
-
@body = f.read
|
30
|
+
@body = read_reference_file(filename)
|
32
31
|
ext = File.extname(filename)[1..-1]
|
33
32
|
ext ||= 'json' if json?(@body)
|
34
33
|
ext && EXTENSIONS.include?(ext) ? EXTENSIONS[ext].new.call(@body) : @body
|
@@ -40,5 +39,15 @@ module JsonRefs
|
|
40
39
|
rescue JSON::ParserError => e
|
41
40
|
false
|
42
41
|
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def read_reference_file(filename)
|
46
|
+
if RUBY_VERSION >= '2.7.0'
|
47
|
+
URI.open(filename, 'r', &:read)
|
48
|
+
else
|
49
|
+
open(filename, 'r', &:read)
|
50
|
+
end
|
51
|
+
end
|
43
52
|
end
|
44
53
|
end
|
data/lib/json_refs/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.4
|
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-
|
11
|
+
date: 2020-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hana
|
@@ -42,14 +42,14 @@ dependencies:
|
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|