Class: RelatonBib::OrgIdentifier

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton_bib/organization.rb

Overview

Organization identifier.

Constant Summary collapse

ORCID =
"orcid"
URI =
"uri"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, value) ⇒ OrgIdentifier

Returns a new instance of OrgIdentifier.

Parameters:

  • type (String)

    “orcid” or “uri”

  • value (String)


34
35
36
37
38
39
40
41
# File 'lib/relaton_bib/organization.rb', line 34

def initialize(type, value)
  unless [ORCID, URI].include? type
    raise ArgumentError, 'Invalid type. It should be "orsid" or "uri".'
  end

  @type  = type
  @value = value
end

Instance Attribute Details

#typeString (readonly)

Returns:

  • (String)


27
28
29
# File 'lib/relaton_bib/organization.rb', line 27

def type
  @type
end

#valueString (readonly)

Returns:

  • (String)


30
31
32
# File 'lib/relaton_bib/organization.rb', line 30

def value
  @value
end

Instance Method Details

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)


44
45
46
# File 'lib/relaton_bib/organization.rb', line 44

def to_xml(builder)
  builder.identifier(value, type: type)
end