Class: RelatonBib::PersonIdentifier
Overview
Person identifier.
Instance Attribute Summary collapse
- #type ⇒ RelatonBib::PersonIdentifierType::ISNI, RelatonBib::PersonIdentifierType::URI
- #value ⇒ String
Instance Method Summary collapse
-
#initialize(type, value) ⇒ PersonIdentifier
constructor
A new instance of PersonIdentifier.
- #to_asciibib(prefix = "", count = 1) ⇒ String
- #to_hash ⇒ Hash
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(type, value) ⇒ PersonIdentifier
Returns a new instance of PersonIdentifier.
130 131 132 133 134 135 |
# File 'lib/relaton_bib/person.rb', line 130 def initialize(type, value) PersonIdentifierType.check type @type = type @value = value end |
Instance Attribute Details
#type ⇒ RelatonBib::PersonIdentifierType::ISNI, RelatonBib::PersonIdentifierType::URI
122 123 124 |
# File 'lib/relaton_bib/person.rb', line 122 def type @type end |
#value ⇒ String
125 126 127 |
# File 'lib/relaton_bib/person.rb', line 125 def value @value end |
Instance Method Details
#to_asciibib(prefix = "", count = 1) ⇒ String
150 151 152 153 154 155 156 |
# File 'lib/relaton_bib/person.rb', line 150 def to_asciibib(prefix = "", count = 1) pref = prefix.empty? ? prefix : prefix + "." out = count > 1 ? "#{prefix}::\n" : "" out += "#{pref}type:: #{type}\n" out += "#{pref}value:: #{value}\n" out end |
#to_hash ⇒ Hash
143 144 145 |
# File 'lib/relaton_bib/person.rb', line 143 def to_hash { "type" => type, "id" => value } end |
#to_xml(builder) ⇒ Object
138 139 140 |
# File 'lib/relaton_bib/person.rb', line 138 def to_xml(builder) builder.identifier value, type: type end |