Class: CBETA::P5aChecker

Inherits:
Object
  • Object
show all
Includes:
CbetaShare
Defined in:
lib/cbeta/p5a_checker.rb

Overview

檢查 CBETA XML P5a

Instance Method Summary collapse

Methods included from CbetaShare

#each_canon, #to_html

Constructor Details

#initialize(xml_root: nil, figures: nil, log: nil) ⇒ P5aChecker

Returns a new instance of P5aChecker.

Parameters:

  • xml_root (String) (defaults to: nil)

    來源 CBETA XML P5a 路徑

  • figures (String) (defaults to: nil)

    插圖 路徑 (可由 github.com/cbeta-git/CBR2X-figures 取得)

  • log (String) (defaults to: nil)

    Log file path



8
9
10
11
12
13
14
15
# File 'lib/cbeta/p5a_checker.rb', line 8

def initialize(xml_root: nil, figures: nil, log: nil)
  @gaijis = CBETA::Gaiji.new
  @xml_root = xml_root
  @figures = figures
  @log = log
  @errors = ''
  @g_errors = {}
end

Instance Method Details

#checkObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/cbeta/p5a_checker.rb', line 17

def check
  puts "xml: #{@xml_root}"
  each_canon(@xml_root) do |c|
    @canon = c
    path = File.join(@xml_root, @canon)
    handle_canon(path)
  end

  display_errors
end

#check_file(fn) ⇒ Object



28
29
30
31
# File 'lib/cbeta/p5a_checker.rb', line 28

def check_file(fn)
  handle_file(fn)
  display_errors
end