class BibTeX::Bibliography

This class represents a bibliography, usually a single BibTeX file.

This is the same class as BibTeX::Bibliography from bibtex-ruby. See those class docs for more information.

Public Instance Methods

all_values(field) click to toggle source

Returns a list of all values of the specified field type, across all entries in the bibliography

This generalizes the names method to arbitrary field types

Ex: all_values(:year)

--> list of all years that appear in the bibliography
# File lib/bibout/bibtex.rb, line 51
def all_values(field)
  return map { |e| e[field] }.flatten.compact.map { |v| v.to_s }.sort.uniq
end
sort(*arguments, &block) click to toggle source

Returns a list of all of the Entries in this bibliography, sorted by in the specified order. Fixes a problem with bibtex-ruby.

# File lib/bibout/bibtex.rb, line 65
def sort(*arguments, &block)
  data.sort(*arguments, &block)
end
sort_by(*arguments, &block) click to toggle source

Returns a list of all of the Entries in this bibliography, sorted by calling the given block. Fixes a problem with the sort_by method in the bibtex-ruby version of this class.

# File lib/bibout/bibtex.rb, line 59
def sort_by(*arguments, &block)
  data.sort_by(*arguments, &block)
end