Sha256: dd299e82b06eff16db90334768164cffeff6e98959a27f0d212470b3d8e709a6

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 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'
require 'active_fedora/noid/model'

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

1 entries across 1 versions & 1 rubygems

Version Path
active_fedora-noid-2.2.0 lib/active_fedora/noid.rb