Class: CBETA::P5aValidator
- Inherits:
-
Object
- Object
- CBETA::P5aValidator
- Defined in:
- lib/cbeta/p5a_validator.rb
Overview
檢查 xml 是否符合 CBETA xml-p5a 編輯體例
Instance Method Summary collapse
-
#check(xml_path) ⇒ String
沒有錯誤的話,傳回空字串,否則傳回錯誤訊息。.
-
#initialize(schema) ⇒ P5aValidator
constructor
A new instance of P5aValidator.
Constructor Details
#initialize(schema) ⇒ P5aValidator
Returns a new instance of P5aValidator.
26 27 28 |
# File 'lib/cbeta/p5a_validator.rb', line 26 def initialize(schema) @schema = schema end |
Instance Method Details
#check(xml_path) ⇒ String
Returns 沒有錯誤的話,傳回空字串,否則傳回錯誤訊息。.
32 33 34 35 36 37 38 39 40 |
# File 'lib/cbeta/p5a_validator.rb', line 32 def check(xml_path) r = '' if Dir.exist? xml_path r = check_folder xml_path else r = check_file xml_path end r end |