Sha256: 99b0bdb762dd309876a78edf33127e4cca7225ed66cfdc9e29be88f61744157f

Contents?: true

Size: 685 Bytes

Versions: 5

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true
require 'active_fedora/noid/version'
require 'active_fedora/noid/config'
require 'active_fedora/noid/engine'
require 'active_fedora/noid/service'
require 'active_fedora/noid/minter'

module ActiveFedora
  module Noid
    class << self
      def configure
        yield config
      end

      def config
        @config ||= Config.new
      end

      def treeify(identifier)
        raise ArgumentError, 'Identifier must be a string of size > 0 in order to be treeified' if identifier.blank?
        head = identifier.split('/').first
        head.gsub!(/#.*/, '')
        (head.scan(/..?/).first(4) + [identifier]).join('/')
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_fedora-noid-2.1.0 lib/active_fedora/noid.rb
active_fedora-noid-2.0.2 lib/active_fedora/noid.rb
active_fedora-noid-2.0.1 lib/active_fedora/noid.rb
active_fedora-noid-2.0.0 lib/active_fedora/noid.rb
active_fedora-noid-2.0.0.beta6 lib/active_fedora/noid.rb