Sha256: d4897d068b6f90b1a88cd6768c126b6f448a7835b78de640bbf577aca92cf506
Contents?: true
Size: 709 Bytes
Versions: 6
Compression:
Stored size: 709 Bytes
Contents
module AsciidoctorBibliography class Bibliographer attr_accessor :citations attr_accessor :indices attr_accessor :database attr_reader :occurring_keys attr_accessor :options def initialize @options = {} @citations = [] @indices = [] @database = nil @occurring_keys = {} end def add_citation(citation) citations << citation citation.citation_items.group_by(&:target).each do |target, citation_items| @occurring_keys[target] ||= [] @occurring_keys[target].concat(citation_items.map(&:key)).uniq! end end def appearance_index_of(target, id) @occurring_keys[target].index(id) + 1 end end end
Version data entries
6 entries across 6 versions & 1 rubygems