Exception: Utopia::Content::MarkupParser::UnbalancedTagError
- Inherits:
-
StandardError
- Object
- StandardError
- Utopia::Content::MarkupParser::UnbalancedTagError
- Defined in:
- lib/utopia/content/markup.rb
Overview
The name of a closing tag fails to match up with the corresponding opening tag.
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
-
#closing_tag ⇒ Object
readonly
Returns the value of attribute closing_tag.
-
#opening_tag ⇒ Object
readonly
Returns the value of attribute opening_tag.
Instance Method Summary collapse
-
#end_location ⇒ Object
Locate the closing tag in the source buffer.
-
#initialize(buffer, opening_tag, closing_tag = nil) ⇒ UnbalancedTagError
constructor
Initialize an error for mismatched source tags.
-
#start_location ⇒ Object
Locate the opening tag in the source buffer.
-
#to_s ⇒ Object
Convert this object to a string.
Constructor Details
#initialize(buffer, opening_tag, closing_tag = nil) ⇒ UnbalancedTagError
Initialize an error for mismatched source tags.
83 84 85 86 87 |
# File 'lib/utopia/content/markup.rb', line 83 def initialize(buffer, opening_tag, closing_tag = nil) @buffer = buffer @opening_tag = opening_tag @closing_tag = closing_tag end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
89 90 91 |
# File 'lib/utopia/content/markup.rb', line 89 def buffer @buffer end |
#closing_tag ⇒ Object (readonly)
Returns the value of attribute closing_tag.
91 92 93 |
# File 'lib/utopia/content/markup.rb', line 91 def closing_tag @closing_tag end |
#opening_tag ⇒ Object (readonly)
Returns the value of attribute opening_tag.
90 91 92 |
# File 'lib/utopia/content/markup.rb', line 90 def opening_tag @opening_tag end |
Instance Method Details
#end_location ⇒ Object
Locate the closing tag in the source buffer.
101 102 103 104 105 |
# File 'lib/utopia/content/markup.rb', line 101 def end_location if closing_tag and closing_tag.respond_to? :offset XRB::Location.new(@buffer.read, closing_tag.offset) end end |
#start_location ⇒ Object
Locate the opening tag in the source buffer.
95 96 97 |
# File 'lib/utopia/content/markup.rb', line 95 def start_location XRB::Location.new(@buffer.read, opening_tag.offset) end |
#to_s ⇒ Object
Convert this object to a string.
109 110 111 112 113 114 115 |
# File 'lib/utopia/content/markup.rb', line 109 def to_s if @closing_tag "#{start_location}: #{@opening_tag} was not closed!" else "#{start_location}: #{@opening_tag} was closed by #{@closing_tag}!" end end |