dslh 0.4.5 → 0.4.6
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 +4 -4
- data/lib/dslh/version.rb +1 -1
- data/lib/dslh.rb +8 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 718c1c22002ee0dc8df5b88ad0b681b4670b459a
|
|
4
|
+
data.tar.gz: 7c658477f9b9cc6c621fb5c97fdb9a5d966db872
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 10b485d527f1212db9c8c47110bd8e06d621edcb27289398254fdca5c4727e527285c30e7d04ed61b6c2f2b3807049f45706ed081eaaabc5cd0c3ba8d30a42cd
|
|
7
|
+
data.tar.gz: 7547c08154e0959c7fdb5f7836ba82271c89b32857e2b5f0381a0186912e454aa8889a0df4b692a85ae463058f7cab9edd40022de8916acb7b0d94173bcd6dd4
|
data/lib/dslh/version.rb
CHANGED
data/lib/dslh.rb
CHANGED
|
@@ -31,6 +31,7 @@ class Dslh
|
|
|
31
31
|
:lineno,
|
|
32
32
|
:root_identify,
|
|
33
33
|
:schema,
|
|
34
|
+
:schema_path,
|
|
34
35
|
:scope_hook,
|
|
35
36
|
:scope_vars,
|
|
36
37
|
:time_inspecter,
|
|
@@ -123,18 +124,22 @@ class Dslh
|
|
|
123
124
|
scope.instance_eval(&block)
|
|
124
125
|
end
|
|
125
126
|
|
|
126
|
-
if schema = @options[:schema]
|
|
127
|
+
if (schema = @options[:schema] || schema_path = @options[:schema_path])
|
|
127
128
|
begin
|
|
128
129
|
require 'kwalify'
|
|
129
130
|
rescue LoadError
|
|
130
131
|
raise 'cannot load "kwalify". please install "kwalify"'
|
|
131
132
|
end
|
|
132
133
|
|
|
133
|
-
|
|
134
|
+
if schema and not schema.kind_of?(String)
|
|
134
135
|
raise TypeError, "wrong schema type #{schema.class} (expected String)"
|
|
135
136
|
end
|
|
136
137
|
|
|
137
|
-
|
|
138
|
+
if schema_path and not schema_path.kind_of?(String)
|
|
139
|
+
raise TypeError, "wrong schema_path type #{schema_path.class} (expected String)"
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
schema = schema_path ? Kwalify::Yaml.load_file(schema_path) : Kwalify::Yaml.load(schema)
|
|
138
143
|
validator = Kwalify::Validator.new(schema)
|
|
139
144
|
|
|
140
145
|
if @options[:root_identify]
|