Sha256: d18b5502c90ea756dca78bb8fa250097a3f3102a845b687e0c281559b943176d

Contents?: true

Size: 509 Bytes

Versions: 4

Compression:

Stored size: 509 Bytes

Contents

module Sufia
  module Noid
    extend ActiveSupport::Concern

    ## This overrides the default behavior, which is to ask Fedora for a pid
    # @see ActiveFedora::Persistence.assign_id
    def assign_id
      Sufia::IdService.mint if Sufia.config.enable_noids
    end

    def to_param
      id
    end

    class << self
      # Create a pairtree like path for the given identifier
      def treeify(identifier)
        (identifier.scan(/..?/).first(4) + [identifier]).join('/')
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
sufia-6.0.0.rc4 sufia-models/app/services/sufia/noid.rb
sufia-models-6.0.0.rc4 app/services/sufia/noid.rb
sufia-6.0.0.rc3 sufia-models/app/services/sufia/noid.rb
sufia-models-6.0.0.rc3 app/services/sufia/noid.rb