class Bibkeys

This class parses a stream of BibTeX input passed to it and provides a method to list its keys, sorted or unsorted.

Constants

VERSION

Public Class Methods

new( stream , sort=false ) click to toggle source

Parses an input stream as if it were a BibTeX file

# File lib/bibkeys.rb, line 14
def initialize ( stream , sort=false )
  @bib = BibTeX.parse( stream )
  @sort = sort
end

Public Instance Methods

list() click to toggle source

List all the keys in the BibTeX file

# File lib/bibkeys.rb, line 21
def list

  keys = Array.new

  @bib.each do |entry|
    keys.push entry.key
  end

  if @sort
    puts keys.sort
  else 
    puts keys
  end

end