jimmy 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jimmy/domain.rb +1 -1
- data/lib/jimmy/reference.rb +4 -2
- data/lib/jimmy/schema_creation.rb +2 -2
- data/lib/jimmy/transform_keys.rb +9 -1
- data/lib/jimmy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a62e54e6b0658797c8fb7c6ca16d2a59f68b53ef
|
4
|
+
data.tar.gz: bdb3b25cfb2ae06ad970e9f577c64bab1400ef4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dc6cf3628f02163eaaa2a946ef8daaecd20afedc422d1635499b32b2982563b89a07963a4325be5656c54c9183740c45aab39196f1d6370ab4dd18743af9de2
|
7
|
+
data.tar.gz: b6c6880288081fdc4a1739ff389739bd8d6e21853caeb3598a314cbd3bb1d0ebdf3383e23b9a30cd39d9df8c9189ad579e886da45a48893cf054c511b14be641
|
data/lib/jimmy/domain.rb
CHANGED
data/lib/jimmy/reference.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
require_relative './transform_keys'
|
2
|
+
|
1
3
|
module Jimmy
|
2
4
|
class Reference
|
3
5
|
include SchemaCreation::MetadataMethods
|
4
6
|
attr_reader :uri, :data
|
5
7
|
|
6
|
-
def initialize(uri, nullable = false, *args, **opts, &block)
|
7
|
-
@uri = uri
|
8
|
+
def initialize(uri, domain, nullable = false, *args, **opts, &block)
|
9
|
+
@uri = TransformKeys.transformer.transform_ref(uri, domain.options[:transform_keys])
|
8
10
|
@nullable = nullable
|
9
11
|
@data = {}
|
10
12
|
args.each { |arg| __send__ arg }
|
@@ -48,7 +48,7 @@ module Jimmy
|
|
48
48
|
|
49
49
|
def ref(*args, uri, &block)
|
50
50
|
handler = SchemaCreation.handlers[self.class]
|
51
|
-
instance_exec(Reference.new(uri, args.delete(:nullable), &block), *args, &handler) if handler
|
51
|
+
instance_exec(Reference.new(uri, domain, args.delete(:nullable), &block), *args, &handler) if handler
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -94,7 +94,7 @@ module Jimmy
|
|
94
94
|
domain.autoload_type method
|
95
95
|
|
96
96
|
if domain.types.key? method
|
97
|
-
return instance_exec TypeReference.new(method, args.include?(:nullable)), *args, &SchemaCreation.handlers[self.class]
|
97
|
+
return instance_exec TypeReference.new(method, domain, args.include?(:nullable)), *args, &SchemaCreation.handlers[self.class]
|
98
98
|
end
|
99
99
|
|
100
100
|
if kind_of_array?(method)
|
data/lib/jimmy/transform_keys.rb
CHANGED
@@ -22,10 +22,18 @@ module Jimmy
|
|
22
22
|
sym
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
def transform_ref(str, method)
|
27
|
+
if method
|
28
|
+
str.sub(/#(.+)/) { '#' << $1.split('/').map { |part| __send__ method, part }.join('/') }
|
29
|
+
else
|
30
|
+
str
|
31
|
+
end
|
32
|
+
end
|
25
33
|
end
|
26
34
|
|
27
35
|
def self.transformer
|
28
36
|
@transformer ||= Transformer.new
|
29
37
|
end
|
30
38
|
end
|
31
|
-
end
|
39
|
+
end
|
data/lib/jimmy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jimmy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil E. Pearson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-schema
|