Class: Mergration::Parser
- Inherits:
-
Object
- Object
- Mergration::Parser
- Defined in:
- lib/mergration/parser.rb
Constant Summary collapse
- DOCUMENT_INPUT =
'KramdownMermaid'
Class Method Summary collapse
Class Method Details
.parse(path) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/mergration/parser.rb', line 12 def self.parse(path) raise Mergration::ParseError, "File does not exist: #{path}" unless File.exist?(path) text = File.read(path) ast = Kramdown::Document.new(text, input: DOCUMENT_INPUT).to_hash_ast ast[:children].select { |k, _| k[:type] == :entity }.map end |