Sha256: 4fb436baca75157e206e19426d9e01b85f4f4c162e2fa9c598da1d6f0bd57168

Contents?: true

Size: 788 Bytes

Versions: 8

Compression:

Stored size: 788 Bytes

Contents

module Ddr
  class Component < Resource

    include Captionable
    include Embargoable
    include HasContent
    include HasDerivedImage
    include HasExtractedText
    include HasIntermediateFile
    include HasMultiresImage
    include HasParent
    include Streamable

    alias_method :item_id, :parent_id
    alias_method :item, :parent

    attribute :target_id, Valkyrie::Types::ID.optional

    self.parent_class = Ddr::Item

    def collection
      self.parent.parent rescue nil
    end

    def collection_id
      self.collection.id rescue nil
    end

    def target
      Ddr.query_service.find_by(id: target_id) if target_id
    end

    def inherited_roles
      if has_parent?
        super | parent.policy_roles
      else
        super
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ddr-core-1.14.0 app/models/ddr/component.rb
ddr-core-1.13.2 app/models/ddr/component.rb
ddr-core-1.13.1 app/models/ddr/component.rb
ddr-core-1.13.0 app/models/ddr/component.rb
ddr-core-1.12.2 app/models/ddr/component.rb
ddr-core-1.12.1 app/models/ddr/component.rb
ddr-core-1.12.0 app/models/ddr/component.rb
ddr-core-1.11.0 app/models/ddr/component.rb