Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/dina/utils/identifier.rb

Instance Method Summary collapse

Instance Method Details

#is_doi?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/dina/utils/identifier.rb', line 12

def is_doi?
  ::Dina::PersistentIdentifier.is_doi_regex.match?(self)
end

#is_orcid?Boolean

Returns:

  • (Boolean)


3
4
5
6
# File 'lib/dina/utils/identifier.rb', line 3

def is_orcid?
  ::Dina::PersistentIdentifier.is_orcid_regex.match?(self) &&
  ::Dina::Identifier.orcid_valid_checksum(self)
end

#is_uuid?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/dina/utils/identifier.rb', line 16

def is_uuid?
  ::Dina::PersistentIdentifier.is_uuid_regex.match?(self)
end

#is_wiki_id?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/dina/utils/identifier.rb', line 8

def is_wiki_id?
  ::Dina::PersistentIdentifier.is_wiki_regex.match?(self)
end

#orcid_from_urlObject



20
21
22
# File 'lib/dina/utils/identifier.rb', line 20

def orcid_from_url
  ::Dina::PersistentIdentifier.extract_orcid_regex.match(self)[0] rescue nil
end

#wiki_from_urlObject



24
25
26
# File 'lib/dina/utils/identifier.rb', line 24

def wiki_from_url
  ::Dina::PersistentIdentifier.extract_wiki_regex.match(self)[0] rescue nil
end