Class: IsoBibItem::FullName
- Inherits:
-
Object
- Object
- IsoBibItem::FullName
- Defined in:
- lib/iso_bib_item/person.rb
Overview
Person’s full name
Instance Attribute Summary collapse
- #additions ⇒ Array<IsoBibItem::LocalizedString>
- #completename ⇒ IsoBibItem::LocalizedString readonly
- #forenames ⇒ Array<IsoBibItem::LocalizedString>
- #initials ⇒ Array<IsoBibItem::LocalizedString>
- #prefix ⇒ Array<IsoBibItem::LocalizedString>
- #surname ⇒ IsoBibItem::LocalizedString
Instance Method Summary collapse
-
#initialize(**args) ⇒ FullName
constructor
A new instance of FullName.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(**args) ⇒ FullName
Returns a new instance of FullName.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/iso_bib_item/person.rb', line 31 def initialize(**args) unless args[:surname] || args[:completename] raise ArgumentError, 'Should be given :surname or :completename' end @surname = args[:surname] @forenames = args[:forenames] @initials = args[:initials] @additions = args[:additions] @prefix = args[:prefix] @completename = args[:completename] end |
Instance Attribute Details
#additions ⇒ Array<IsoBibItem::LocalizedString>
18 19 20 |
# File 'lib/iso_bib_item/person.rb', line 18 def additions @additions end |
#completename ⇒ IsoBibItem::LocalizedString (readonly)
24 25 26 |
# File 'lib/iso_bib_item/person.rb', line 24 def completename @completename end |
#forenames ⇒ Array<IsoBibItem::LocalizedString>
9 10 11 |
# File 'lib/iso_bib_item/person.rb', line 9 def forenames @forenames end |
#initials ⇒ Array<IsoBibItem::LocalizedString>
12 13 14 |
# File 'lib/iso_bib_item/person.rb', line 12 def initials @initials end |
#prefix ⇒ Array<IsoBibItem::LocalizedString>
21 22 23 |
# File 'lib/iso_bib_item/person.rb', line 21 def prefix @prefix end |
#surname ⇒ IsoBibItem::LocalizedString
15 16 17 |
# File 'lib/iso_bib_item/person.rb', line 15 def surname @surname end |
Instance Method Details
#to_xml(builder) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/iso_bib_item/person.rb', line 44 def to_xml(builder) builder.name do if completename builder.completename { completename.to_xml builder } else builder.prefix { prefix.each { |p| p.to_xml builder } } if prefix builder.initial { initials.each { |i| i.to_xml builder } } if initials builder.addition { additions.each { |a| a.to_xml builder } } if additions builder.surname { surname.to_xml builder } builder.forename { forenames.each { |f| f.to_xml builder } } if forenames end end end |