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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dslh/version.rb +1 -1
  3. data/lib/dslh.rb +8 -3
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aabcb22d12772bb0f3f30332055b62c9719891cb
4
- data.tar.gz: a52cf05a55c804ef3b62335765e223527b540d16
3
+ metadata.gz: 718c1c22002ee0dc8df5b88ad0b681b4670b459a
4
+ data.tar.gz: 7c658477f9b9cc6c621fb5c97fdb9a5d966db872
5
5
  SHA512:
6
- metadata.gz: bbe809b304460e27270f19445b72f18cb30d06a7c93322297626857c3816bc9c5866c958e2007fa140fb9ec5648544ab6b13deadbedbfa6f070ad06118131e8c
7
- data.tar.gz: e720f203b599c765179cbb33064e1c0bf263d26ea09841c41f87cab66adbca14111a191f0032df8e5fb92f637e60ff2ea5a8b3131ee91b550bc7649b0f699ebc
6
+ metadata.gz: 10b485d527f1212db9c8c47110bd8e06d621edcb27289398254fdca5c4727e527285c30e7d04ed61b6c2f2b3807049f45706ed081eaaabc5cd0c3ba8d30a42cd
7
+ data.tar.gz: 7547c08154e0959c7fdb5f7836ba82271c89b32857e2b5f0381a0186912e454aa8889a0df4b692a85ae463058f7cab9edd40022de8916acb7b0d94173bcd6dd4
data/lib/dslh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Dslh
2
- VERSION = '0.4.5'
2
+ VERSION = '0.4.6'
3
3
  end
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
- unless schema.kind_of?(String)
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
- schema = Kwalify::Yaml.load(schema)
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]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dslh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara