Sha256: acbd8c775e0fc6cfc99378eba85544c5b0527ae59bad2534880aa70fa223439b

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

require 'active_support'
require 'mime/types'
require 'active_fedora/aggregation'

module Hydra
  module PCDM
    extend ActiveSupport::Autoload

    module Vocab
      extend ActiveSupport::Autoload
      eager_autoload do
        autoload :PCDMTerms
      end
    end

    autoload :Config

    # models
    autoload_under 'models' do
      autoload :Collection
      autoload :Object
      autoload :File
    end

    # behavior concerns
    autoload_under 'models/concerns' do
      autoload :CollectionBehavior
      autoload :ObjectBehavior
      autoload :PcdmBehavior
    end

    autoload :PCDMIndexer
    autoload :CollectionIndexer
    autoload :ObjectIndexer

    # file services
    autoload :AddTypeToFile,                     'hydra/pcdm/services/file/add_type'
    autoload :GetMimeTypeForFile,                'hydra/pcdm/services/file/get_mime_type'

    # Associations
    autoload :AncestorChecker,                   'hydra/pcdm/ancestor_checker'
    autoload :Validators,                        'hydra/pcdm/validators'

    # model validations
    def self.collection?(collection)
      return false unless collection.respond_to? :type
      Array(collection.type).include? Vocab::PCDMTerms.Collection
    end

    def self.object?(object)
      return false unless object.respond_to? :type
      Array(object.type).include? Vocab::PCDMTerms.Object
    end

    def self.file?(file)
      return false unless file.respond_to? :metadata_node
      Array(file.metadata_node.type).include? Vocab::PCDMTerms.File
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hydra-pcdm-1.4.0 lib/hydra/pcdm.rb
hydra-pcdm-1.3.0 lib/hydra/pcdm.rb
hydra-pcdm-1.2.0 lib/hydra/pcdm.rb
hydra-pcdm-1.1.0 lib/hydra/pcdm.rb
hydra-pcdm-1.0.1 lib/hydra/pcdm.rb
hydra-pcdm-1.0.0 lib/hydra/pcdm.rb
hydra-pcdm-0.11.0 lib/hydra/pcdm.rb
hydra-pcdm-0.10.0 lib/hydra/pcdm.rb
hydra-pcdm-0.9.0 lib/hydra/pcdm.rb