Exception: Moxml::AttributeError
- Defined in:
- lib/moxml/error.rb
Overview
Error raised when attribute operations fail
Instance Attribute Summary collapse
-
#attribute_name ⇒ Object
readonly
Returns the value of attribute attribute_name.
-
#element ⇒ Object
readonly
Returns the value of attribute element.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(message, name: nil, element: nil, value: nil) ⇒ AttributeError
constructor
A new instance of AttributeError.
- #to_s ⇒ Object
Constructor Details
#initialize(message, name: nil, element: nil, value: nil) ⇒ AttributeError
Returns a new instance of AttributeError.
153 154 155 156 157 158 |
# File 'lib/moxml/error.rb', line 153 def initialize(, name: nil, element: nil, value: nil) @attribute_name = name @element = element @value = value super() end |
Instance Attribute Details
#attribute_name ⇒ Object (readonly)
Returns the value of attribute attribute_name.
151 152 153 |
# File 'lib/moxml/error.rb', line 151 def attribute_name @attribute_name end |
#element ⇒ Object (readonly)
Returns the value of attribute element.
151 152 153 |
# File 'lib/moxml/error.rb', line 151 def element @element end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
151 152 153 |
# File 'lib/moxml/error.rb', line 151 def value @value end |
Instance Method Details
#to_s ⇒ Object
160 161 162 163 164 165 166 167 |
# File 'lib/moxml/error.rb', line 160 def to_s msg = super msg += "\n Attribute: #{@attribute_name}" if @attribute_name msg += "\n Element: <#{@element.name}>" if @element.respond_to?(:name) msg += "\n Value: #{@value.inspect}" if @value msg += "\n Hint: Verify attribute name follows XML naming rules" msg end |