Sha256: b4b8b2300baeed36c36ca36e861ce170b75b77faa7850e9c8caf89dee36dbdf8

Contents?: true

Size: 861 Bytes

Versions: 10

Compression:

Stored size: 861 Bytes

Contents

# frozen_string_literal: true

module ModsDisplay
  module RelatedItemConcerns
    private

    def render_nested_related_item?(item)
      related_item_is_a_constituent?(item) || related_item_is_host?(item)
    end

    def related_item_is_a_collection?(item)
      item.respond_to?(:titleInfo) &&
        item.respond_to?(:typeOfResource) &&
        !item.typeOfResource.attributes.empty? &&
        item.typeOfResource.attributes.first.key?('collection') &&
        item.typeOfResource.attributes.first['collection'].value == 'yes'
    end

    def related_item_is_a_constituent?(item)
      item.attributes['type'].respond_to?(:value) &&
        item.attributes['type'].value == 'constituent'
    end

    def related_item_is_host?(item)
      item.attributes['type'].respond_to?(:value) &&
        item.attributes['type'].value == 'host'
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mods_display-1.3.4 lib/mods_display/related_item_concerns.rb
mods_display-1.3.3 lib/mods_display/related_item_concerns.rb
mods_display-1.3.2 lib/mods_display/related_item_concerns.rb
mods_display-1.3.1 lib/mods_display/related_item_concerns.rb
mods_display-1.3.0 lib/mods_display/related_item_concerns.rb
mods_display-1.2.1 lib/mods_display/related_item_concerns.rb
mods_display-1.2.0 lib/mods_display/related_item_concerns.rb
mods_display-1.1.0 lib/mods_display/related_item_concerns.rb
mods_display-1.0.0 lib/mods_display/related_item_concerns.rb
mods_display-1.0.0.alpha5 lib/mods_display/related_item_concerns.rb