Sha256: 4ba024c2b215fe4f94b66c4ed92f4687af81d3b9420f4f83de87b3d8528bffb8

Contents?: true

Size: 1.07 KB

Versions: 33

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true
module Hyrax
  module Identifier
    class Registrar
      class << self
        ##
        # @param type [Symbol]
        # @param opts [Hash]
        # @option opts [Hyrax::Identifier::Builder] :builder
        #
        # @return [Hyrax::Identifier::Registrar] a registrar for the given type
        def for(type, **opts)
          return Hyrax.config.identifier_registrars[type].new(**opts) if Hyrax.config.identifier_registrars.include?(type)
          raise ArgumentError, "Hyrax::Identifier::Registrar not found to handle #{type}"
        end
      end

      ##
      # @!attribute builder [rw]
      #   @return [Hyrax::Identifier::Builder]
      attr_accessor :builder

      ##
      # @param builder [Hyrax::Identifier::Builder]
      def initialize(builder:)
        @builder = builder
      end

      ##
      # @abstract
      #
      # @param object [#id]
      #
      # @return [#identifier]
      # @raise [NotImplementedError] when the method is abstract
      def register!(*)
        raise NotImplementedError
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
hyrax-5.0.2 app/services/hyrax/identifier/registrar.rb
hyrax-5.0.1 app/services/hyrax/identifier/registrar.rb
hyrax-5.0.0 app/services/hyrax/identifier/registrar.rb
hyrax-5.0.0.rc3 app/services/hyrax/identifier/registrar.rb
hyrax-5.0.0.rc2 app/services/hyrax/identifier/registrar.rb
hyrax-5.0.0.rc1 app/services/hyrax/identifier/registrar.rb
hyrax-3.6.0 app/services/hyrax/identifier/registrar.rb
hyrax-4.0.0 app/services/hyrax/identifier/registrar.rb
hyrax-4.0.0.rc3 app/services/hyrax/identifier/registrar.rb
hyrax-4.0.0.rc2 app/services/hyrax/identifier/registrar.rb
hyrax-4.0.0.rc1 app/services/hyrax/identifier/registrar.rb
hyrax-3.5.0 app/services/hyrax/identifier/registrar.rb
hyrax-4.0.0.beta2 app/services/hyrax/identifier/registrar.rb
hyrax-3.4.2 app/services/hyrax/identifier/registrar.rb
hyrax-4.0.0.beta1 app/services/hyrax/identifier/registrar.rb
hyrax-3.4.1 app/services/hyrax/identifier/registrar.rb
hyrax-3.4.0 app/services/hyrax/identifier/registrar.rb
hyrax-3.3.0 app/services/hyrax/identifier/registrar.rb
hyrax-3.2.0 app/services/hyrax/identifier/registrar.rb
hyrax-2.9.6 app/services/hyrax/identifier/registrar.rb