Exception: Rng::SchemaValidationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rng/schema_validator.rb

Overview

Raised when a schema violates RELAX NG structural rules

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, xpath: nil, line: nil) ⇒ SchemaValidationError

Returns a new instance of SchemaValidationError.



11
12
13
14
15
# File 'lib/rng/schema_validator.rb', line 11

def initialize(message, xpath: nil, line: nil)
  super(message)
  @xpath = xpath
  @line = line
end

Instance Attribute Details

#lineObject (readonly)

Returns the value of attribute line.



9
10
11
# File 'lib/rng/schema_validator.rb', line 9

def line
  @line
end

#xpathObject (readonly)

Returns the value of attribute xpath.



9
10
11
# File 'lib/rng/schema_validator.rb', line 9

def xpath
  @xpath
end

Instance Method Details

#to_sObject



17
18
19
20
21
# File 'lib/rng/schema_validator.rb', line 17

def to_s
  location = [@xpath, @line].compact.join(':')
  base = super
  location.empty? ? base : "#{location}: #{base}"
end