Class: IsoBibItem::Organization

Inherits:
Contributor show all
Defined in:
lib/iso_bib_item/organization.rb

Overview

Organization.

Instance Attribute Summary collapse

Attributes inherited from Contributor

#contacts, #uri

Instance Method Summary collapse

Methods inherited from Contributor

#url

Constructor Details

#initialize(name:, abbreviation: nil, url: nil) ⇒ Organization

Returns a new instance of Organization.

Parameters:

  • name (String)
  • abbreviation (String) (defaults to: nil)
  • url (String) (defaults to: nil)


46
47
48
49
50
51
# File 'lib/iso_bib_item/organization.rb', line 46

def initialize(name:, abbreviation: nil, url: nil)
  super(url: url)
  @name         = LocalizedString.new name
  @abbreviation = LocalizedString.new abbreviation
  @identifiers  = []
end

Instance Attribute Details

#abbreviationIsoBibItem::LocalizedString (readonly)



37
38
39
# File 'lib/iso_bib_item/organization.rb', line 37

def abbreviation
  @abbreviation
end

#identifiersArray<IsoBibItem::OrgIdentifier> (readonly)



40
41
42
# File 'lib/iso_bib_item/organization.rb', line 40

def identifiers
  @identifiers
end

#nameIsoBibItem::LocalizedString (readonly)



34
35
36
# File 'lib/iso_bib_item/organization.rb', line 34

def name
  @name
end

Instance Method Details

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)


54
55
56
57
58
59
60
61
62
# File 'lib/iso_bib_item/organization.rb', line 54

def to_xml(builder)
  builder.organization do
    builder.name { |b| name.to_xml b }
    builder.abbreviation { |a| abbreviation.to_xml a } if abbreviation&.to_s
    builder.uri uri.to_s if uri
    identifiers.each { |identifier| identifier.to_xml builder }
    super
  end
end