Module: Ibex::Codegen::Documentation

Defined in:
lib/ibex/codegen/documentation.rb

Overview

Renders normalized user rules as deterministic Markdown, HTML, or railroad SVG.

Constant Summary collapse

FORMATS =

: Array

%w[markdown html railroad].freeze

Class Method Summary collapse

Class Method Details

.render(grammar, format:) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/ibex/codegen/documentation.rb', line 14

def render(grammar, format:)
  case format.to_s
  when "markdown" then render_markdown(grammar)
  when "html" then render_html(grammar)
  when "railroad" then Railroad.render(grammar)
  else raise ArgumentError, "unsupported documentation format #{format.inspect}"
  end
end