Class: BibTeX::Error

Inherits:
Element show all
Defined in:
lib/bibtex/error.rb

Overview

Represents a lexical or syntactical error.

Instance Attribute Summary collapse

Attributes inherited from Element

#bibliography, #id

Instance Method Summary collapse

Methods inherited from Element

#<=>, #digest, #has_type?, #inspect, #join, #matches?, #meets?, #meets_all?, #meets_any?, #names, parse, #replace, #to_hash, #to_json, #to_xml, #to_yaml, #type, #values_at

Constructor Details

#initialize(trace = []) ⇒ Error

Returns a new instance of Error.



20
21
22
# File 'lib/bibtex/error.rb', line 20

def initialize(trace = [])
  @trace = trace
end

Instance Attribute Details

#traceObject

Returns the value of attribute trace.



18
19
20
# File 'lib/bibtex/error.rb', line 18

def trace
  @trace
end

Instance Method Details

#added_to_bibliography(bibliography) ⇒ Object

Called when the element was added to a bibliography.



35
36
37
38
39
# File 'lib/bibtex/error.rb', line 35

def added_to_bibliography(bibliography)
  super(bibliography)
  bibliography.errors << self
  self
end

#contentObject



30
31
32
# File 'lib/bibtex/error.rb', line 30

def content
  @trace.map { |e| e[1] }.join
end

#removed_from_bibliography(bibliography) ⇒ Object

Called when the element was removed from a bibliography.



42
43
44
45
46
# File 'lib/bibtex/error.rb', line 42

def removed_from_bibliography(bibliography)
  super(bibliography)
  bibliography.errors.delete(self)
  self
end