Sha256: 4da0f48df082bdd84960845219910a8eefa2ae56fb6141d82f2526ea6415b8d0

Contents?: true

Size: 644 Bytes

Versions: 2

Compression:

Stored size: 644 Bytes

Contents

require_relative 'databases/bibtex'
require_relative 'exceptions'

module AsciidoctorBibliography
  # This is an array of citeproc entries.
  class Database < Array
    def initialize(*filenames)
      filenames.each do |filename|
        append filename
      end
    end

    def append(filename)
      concat Database.load(filename)
    end

    def self.load(filename)
      case File.extname(filename)
      when *Databases::BibTeX::EXTENSIONS
        Databases::BibTeX.load(filename)
      else
        raise Exceptions::DatabaseFormatNotSupported,
              'Bibliographic database format not supported.'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
asciidoctor-bibliography-0.2.1 lib/asciidoctor-bibliography/database.rb
asciidoctor-bibliography-0.2.0 lib/asciidoctor-bibliography/database.rb