Sha256: 6490a4458bb4049e0b05f821fff6d3904ef4c74901a6d10f41490cd14b3b353f

Contents?: true

Size: 506 Bytes

Versions: 12

Compression:

Stored size: 506 Bytes

Contents

module Sufia
  module Noid
    def Noid.noidify(identifier)
      identifier.split(":").last
    end

    def Noid.namespaceize(identifier)
      if identifier.start_with?(Noid.namespace)
        identifier
      else
        "#{Noid.namespace}:#{identifier}"
      end
    end

    def noid
      Noid.noidify(self.pid)
    end

    def normalize_identifier
      params[:id] = Noid.namespaceize(params[:id])
    end

    protected
    def Noid.namespace
      Sufia.config.id_namespace
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
sufia-3.3.1 sufia-models/lib/sufia/models/noid.rb
sufia-models-3.3.1 lib/sufia/models/noid.rb
sufia-3.4.0.rc2 sufia-models/lib/sufia/models/noid.rb
sufia-models-3.4.0.rc2 lib/sufia/models/noid.rb
sufia-3.4.0.rc1 sufia-models/lib/sufia/models/noid.rb
sufia-models-3.4.0.rc1 lib/sufia/models/noid.rb
sufia-3.3.0 sufia-models/lib/sufia/models/noid.rb
sufia-models-3.3.0 lib/sufia/models/noid.rb
sufia-3.2.1 sufia-models/lib/sufia/models/noid.rb
sufia-models-3.2.1 lib/sufia/models/noid.rb
sufia-3.1.3 sufia-models/lib/sufia/models/noid.rb
sufia-models-3.1.3 lib/sufia/models/noid.rb