Exception: Utopia::Content::MarkupParser::UnbalancedTagError
- Inherits:
-
StandardError
- Object
- StandardError
- Utopia::Content::MarkupParser::UnbalancedTagError
- Defined in:
- lib/utopia/content/markup.rb
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
-
#initialize(buffer, opening_tag, closing_tag = nil) ⇒ UnbalancedTagError
constructor
A new instance of UnbalancedTagError.
- #start_location ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(buffer, opening_tag, closing_tag = nil) ⇒ UnbalancedTagError
Returns a new instance of UnbalancedTagError.
68 69 70 71 72 |
# File 'lib/utopia/content/markup.rb', line 68 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.
74 75 76 |
# File 'lib/utopia/content/markup.rb', line 74 def buffer @buffer end |
#closing_tag ⇒ Object (readonly)
Returns the value of attribute closing_tag.
76 77 78 |
# File 'lib/utopia/content/markup.rb', line 76 def closing_tag @closing_tag end |
#opening_tag ⇒ Object (readonly)
Returns the value of attribute opening_tag.
75 76 77 |
# File 'lib/utopia/content/markup.rb', line 75 def opening_tag @opening_tag end |
Instance Method Details
#end_location ⇒ Object
82 83 84 85 86 |
# File 'lib/utopia/content/markup.rb', line 82 def end_location if closing_tag and closing_tag.respond_to? :offset Trenni::Location.new(@buffer.read, closing_tag.offset) end end |
#start_location ⇒ Object
78 79 80 |
# File 'lib/utopia/content/markup.rb', line 78 def start_location Trenni::Location.new(@buffer.read, opening_tag.offset) end |
#to_s ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/utopia/content/markup.rb', line 88 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 |