Sha256: 8912fd08e8c6d4e351c9863484563c31d007b543f90a6cfdd918fe06aadf13d7

Contents?: true

Size: 514 Bytes

Versions: 24

Compression:

Stored size: 514 Bytes

Contents

module Sufia
  module Noid
    def Noid.noidify(identifier)
      String(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

24 entries across 24 versions & 2 rubygems

Version Path
sufia-models-4.0.0.beta3 app/services/sufia/noid.rb
sufia-4.0.0.beta3 sufia-models/app/services/sufia/noid.rb
sufia-4.0.0.beta2 sufia-models/app/services/sufia/noid.rb
sufia-models-4.0.0.beta2 app/services/sufia/noid.rb
sufia-4.0.0.beta1 sufia-models/app/services/sufia/noid.rb
sufia-models-4.0.0.beta1 app/services/sufia/noid.rb
sufia-models-3.7.2 lib/sufia/models/noid.rb
sufia-3.7.2 sufia-models/lib/sufia/models/noid.rb
sufia-models-3.7.1 lib/sufia/models/noid.rb
sufia-3.7.1 sufia-models/lib/sufia/models/noid.rb
sufia-models-3.7.0 lib/sufia/models/noid.rb
sufia-3.7.0 sufia-models/lib/sufia/models/noid.rb
sufia-3.6.1 sufia-models/lib/sufia/models/noid.rb
sufia-models-3.6.1 lib/sufia/models/noid.rb
sufia-3.6.0 sufia-models/lib/sufia/models/noid.rb
sufia-models-3.6.0 lib/sufia/models/noid.rb
sufia-3.5.0 sufia-models/lib/sufia/models/noid.rb
sufia-models-3.5.0 lib/sufia/models/noid.rb
sufia-3.4.0 sufia-models/lib/sufia/models/noid.rb
sufia-models-3.4.0 lib/sufia/models/noid.rb