Exception: Docdown::Parser::ParseError

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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ParseError



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/docdown/parser.rb', line 4

def initialize(options = {})
  keyword     = options[:keyword]
  command     = options[:command]
  line_number = options[:line_number]
  block       = options[:block].lines.map do |line|
    if line == command
      "    > #{line}"
    else
      "      #{line}"
    end
  end.join("")

  msg =  "Error parsing (line:#{line_number}):\n"
  msg << ">  '#{command.strip}'\n"
  msg << "No such registered command: '#{keyword}'\n"
  msg << "registered commands: #{Docdown.known_commands.inspect}\n\n"
  msg << block
  msg << "\n"
  super msg
end