Sha256: 761baf852a5c6a2b7b6430dd0c74fb9a7a0bacc5bff6d1188b07031548e8742a

Contents?: true

Size: 826 Bytes

Versions: 14

Compression:

Stored size: 826 Bytes

Contents

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

14 entries across 14 versions & 1 rubygems

Version Path
mods_display-1.0.0.alpha4 lib/mods_display/related_item_concerns.rb
mods_display-1.0.0.alpha3 lib/mods_display/related_item_concerns.rb
mods_display-1.0.0.alpha2 lib/mods_display/related_item_concerns.rb
mods_display-1.0.0.alpha1 lib/mods_display/related_item_concerns.rb
mods_display-0.10.1 lib/mods_display/related_item_concerns.rb
mods_display-0.10.0 lib/mods_display/related_item_concerns.rb
mods_display-0.9.1 lib/mods_display/related_item_concerns.rb
mods_display-0.9.0 lib/mods_display/related_item_concerns.rb
mods_display-0.8.0 lib/mods_display/related_item_concerns.rb
mods_display-0.7.1 lib/mods_display/related_item_concerns.rb
mods_display-0.7.0 lib/mods_display/related_item_concerns.rb
mods_display-0.6.0 lib/mods_display/related_item_concerns.rb
mods_display-0.5.1 lib/mods_display/related_item_concerns.rb
mods_display-0.5.0 lib/mods_display/related_item_concerns.rb