Class: Identifier::Global::Lsid

Inherits:
Identifier::Global show all
Defined in:
app/models/identifier/global/lsid.rb

Overview

urn:lsid:Orthoptera.speciesfile.org:TaxonName:1

• "URN"
• "LSID"
• authority identification
• namespace identification
• object identification
• optionally: revision identification. If revision field is omitted then the trailing colon is also omitted.

Constant Summary

Constant Summary

Constants inherited from Identifier

SHORT_NAMES

Instance Attribute Summary

Attributes inherited from Identifier::Global

#relation

Attributes inherited from Identifier

#cached, #identifier, #identifier_object_id, #namespace_id, #project_id, #type

Instance Method Summary (collapse)

Methods inherited from Identifier::Global

#permit_only_one_global_without_relation_supplied_per_type, #set_cached

Methods inherited from Identifier

#annotated_object, class_name, find_for_autocomplete, generate_download, #klass_name, prototype_identifier, #set_cached

Methods included from Housekeeping

#has_polymorphic_relationship?

Instance Method Details

- (Object) using_lsid_class



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/models/identifier/global/lsid.rb', line 13

def using_lsid_class
  retval = true
  unless identifier.nil?
    lsid = identifier.split(':')
    # this is a test of http://rubular.com/regexes/13295
    /SID=([\s\S]*?)LSID=([\s\S]*?)Auth=([\s\S]*)/ =~ identifier

    unless lsid.length.between?(5, 6)
      unless lsid[0].upcase == 'URN' and lsid[1].upcase == 'LSID'
        errors.add(:identifier, "'#{identifier}' is not a valid LSID.")
        retval = false
      end
    end
  end
  return retval
end