Exception: Moxml::XPath::InvalidContextError

Inherits:
Error show all
Defined in:
lib/moxml/xpath/errors.rb

Overview

Error raised when an XPath function is called without required context

Instance Attribute Summary collapse

Attributes inherited from Moxml::XPathError

#adapter, #expression, #node

Instance Method Summary collapse

Constructor Details

#initialize(message, expression: nil, function_name: nil, required_context: nil) ⇒ InvalidContextError

Returns a new instance of InvalidContextError.



86
87
88
89
90
91
# File 'lib/moxml/xpath/errors.rb', line 86

def initialize(message, expression: nil, function_name: nil,
required_context: nil)
  @function_name = function_name
  @required_context = required_context
  super(message, expression: expression)
end

Instance Attribute Details

#function_nameObject (readonly)

Returns the value of attribute function_name.



84
85
86
# File 'lib/moxml/xpath/errors.rb', line 84

def function_name
  @function_name
end

#required_contextObject (readonly)

Returns the value of attribute required_context.



84
85
86
# File 'lib/moxml/xpath/errors.rb', line 84

def required_context
  @required_context
end

Instance Method Details

#to_sObject



93
94
95
96
97
98
# File 'lib/moxml/xpath/errors.rb', line 93

def to_s
  msg = super
  msg += "\n  Function: #{@function_name}" if @function_name
  msg += "\n  Required context: #{@required_context}" if @required_context
  msg
end