class BibTeX::Error

Represents a lexical or syntactical error.

Attributes

trace[R]

Public Class Methods

new(trace = []) click to toggle source
# File lib/bibtex/error.rb, line 20
def initialize(trace = [])
  @trace = trace
end

Public Instance Methods

added_to_bibliography(bibliography) click to toggle source

Called when the element was added to a bibliography.

Calls superclass method BibTeX::Element#added_to_bibliography
# File lib/bibtex/error.rb, line 35
def added_to_bibliography(bibliography)
  super(bibliography)
  bibliography.errors << self
  self
end
content() click to toggle source
# File lib/bibtex/error.rb, line 30
def content
  @trace.map { |e| e[1] }.join
end
removed_from_bibliography(bibliography) click to toggle source

Called when the element was removed from a bibliography.

# File lib/bibtex/error.rb, line 42
def removed_from_bibliography(bibliography)
  super(bibliography)
  bibliography.errors.delete(self)
  self
end
trace=(trace) click to toggle source
# File lib/bibtex/error.rb, line 24
def trace=(trace)
  raise(ArgumentError, "BibTeX::Error trace must be of type Array; was: #{trace.class.name}.") unless trace.is_a?(Array)

  @trace = trace
end