Sha256: 92af00f3d9c566f68b6d3a6a4f4030c38bf6c94e34c4a19bfd6985def9b38336

Contents?: true

Size: 720 Bytes

Versions: 25

Compression:

Stored size: 720 Bytes

Contents

# frozen_string_literal: true

module RelatonBib
  # Document relation collection
  class DocRelationCollection < Array
    # @param relation [Array<RelatonBib::DocumentRelation, Hash>]
    # @option relation [String] :type
    # @option relation [String] :identifier
    # @option relation [String, NIllClass] :url (nil)
    # @option relation [Array<RelatonBib::BibItemLocality>] :bib_locality
    # @option relation [RelatonBib::BibliographicItem, NillClass] :bibitem (nil)
    def initialize(relation)
      super relation.map { |r| r.is_a?(Hash) ? DocumentRelation.new(r) : r }
    end

    # @return [Array<RelatonBib::DocumentRelation>]
    def replaces
      select { |r| r.type == "replace" }
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
relaton-bib-0.3.4 lib/relaton_bib/document_relation_collection.rb
relaton-bib-0.3.3 lib/relaton_bib/document_relation_collection.rb
relaton-bib-0.3.2 lib/relaton_bib/document_relation_collection.rb
relaton-bib-0.3.1 lib/relaton_bib/document_relation_collection.rb
relaton-bib-0.3.0 lib/relaton_bib/document_relation_collection.rb