Class: BibTeX::Error
Overview
Represents a lexical or syntactical error.
Instance Attribute Summary collapse
-
#trace ⇒ Object
Returns the value of attribute trace.
Attributes inherited from Element
Instance Method Summary collapse
-
#added_to_bibliography(bibliography) ⇒ Object
Called when the element was added to a bibliography.
- #content ⇒ Object
-
#initialize(trace = []) ⇒ Error
constructor
A new instance of Error.
-
#removed_from_bibliography(bibliography) ⇒ Object
Called when the element was removed from a bibliography.
Methods inherited from Element
#to_hash, #to_json, #to_s, #to_xml, #to_yaml
Constructor Details
#initialize(trace = []) ⇒ Error
Returns a new instance of Error.
10 11 12 |
# File 'lib/bibtex/error.rb', line 10 def initialize(trace=[]) @trace = trace end |
Instance Attribute Details
#trace ⇒ Object
Returns the value of attribute trace.
8 9 10 |
# File 'lib/bibtex/error.rb', line 8 def trace @trace end |
Instance Method Details
#added_to_bibliography(bibliography) ⇒ Object
Called when the element was added to a bibliography.
24 25 26 27 28 |
# File 'lib/bibtex/error.rb', line 24 def added_to_bibliography(bibliography) super(bibliography) bibliography.errors << self self end |
#content ⇒ Object
19 20 21 |
# File 'lib/bibtex/error.rb', line 19 def content @trace.map { |e| e[1] }.join end |
#removed_from_bibliography(bibliography) ⇒ Object
Called when the element was removed from a bibliography.
31 32 33 34 35 |
# File 'lib/bibtex/error.rb', line 31 def removed_from_bibliography(bibliography) super(bibliography) bibliography.errors.delete(self) self end |