Class: Adocconf::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/adocconf/parser.rb

Instance Method Summary collapse

Instance Method Details

#parse_file(path) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/adocconf/parser.rb', line 3

def parse_file(path)
  raise ParseError, "File not found: #{path}" unless File.file?(path)

  doc = Asciidoctor.load_file(path, safe: :safe, parse: true)
  Extractor.new(doc).extract
rescue Adocconf::Error
  raise
rescue StandardError => e
  raise ParseError, e.message
end