Class: BibTeX::Preamble

Inherits:
Element show all
Includes:
Replaceable
Defined in:
lib/bibtex/elements.rb

Overview

Represents a @preamble object.

In BibTeX an @preamble object contains a single string literal, a single constant, or a concatenation of string literals and constants.

Instance Attribute Summary

Attributes included from Replaceable

#value

Attributes inherited from Element

#bibliography, #id

Instance Method Summary collapse

Methods included from Replaceable

#<<, #join, #replace

Methods inherited from Element

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

Constructor Details

#initialize(value = '') ⇒ Preamble

Creates a new instance.



255
256
257
# File 'lib/bibtex/elements.rb', line 255

def initialize(value = '')
  @value = Value.new(value)
end

Instance Method Details

#contentObject

Returns a string representation of the @preamble’s content.



260
261
262
# File 'lib/bibtex/elements.rb', line 260

def content
  @value.to_s(:quotes => '"')
end

#to_s(options = {}) ⇒ Object

Returns a string representation of the @preamble object



265
266
267
# File 'lib/bibtex/elements.rb', line 265

def to_s(options = {})
  "@preamble{ #{content} }"
end