Class: RelatonBib::PersonIdentifier

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

Overview

Person identifier.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, value) ⇒ PersonIdentifier

Returns a new instance of PersonIdentifier.



107
108
109
110
111
112
# File 'lib/relaton_bib/person.rb', line 107

def initialize(type, value)
  PersonIdentifierType.check type

  @type  = type
  @value = value
end

Instance Attribute Details

#typeRelatonBib::PersonIdentifierType::ISNI, RelatonBib::PersonIdentifierType::URI



100
101
102
# File 'lib/relaton_bib/person.rb', line 100

def type
  @type
end

#valueString

Returns:

  • (String)


103
104
105
# File 'lib/relaton_bib/person.rb', line 103

def value
  @value
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


120
121
122
# File 'lib/relaton_bib/person.rb', line 120

def to_hash
  { type: type, id: value }
end

#to_xml(builder) ⇒ Object

Parameters:

  • builser (Nokogiri::XML::Builder)


115
116
117
# File 'lib/relaton_bib/person.rb', line 115

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