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

#<=>, #has_type?, #join, #matches?, #meets?, parse, #replace, #to_hash, #to_json, #to_xml, #to_yaml, #type

Constructor Details

#initialize(trace = []) ⇒ Error

Returns a new instance of Error.



12
13
14
# File 'lib/bibtex/error.rb', line 12

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

Instance Attribute Details

#traceObject

Returns the value of attribute trace.



10
11
12
# File 'lib/bibtex/error.rb', line 10

def trace
  @trace
end

Instance Method Details

#added_to_bibliography(bibliography) ⇒ Object

Called when the element was added to a bibliography.



26
27
28
29
30
# File 'lib/bibtex/error.rb', line 26

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

#contentObject



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

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

#removed_from_bibliography(bibliography) ⇒ Object

Called when the element was removed from a bibliography.



33
34
35
36
37
# File 'lib/bibtex/error.rb', line 33

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