class IsoBibItem::Organization

Organization.

Attributes

abbreviation[R]

@return [IsoBibItem::LocalizedString]

identifiers[R]

@return [Array<IsoBibItem::OrgIdentifier>]

name[R]

@return [IsoBibItem::LocalizedString]

Public Class Methods

new(name:, abbreviation: nil, url: nil, identifiers: []) click to toggle source

@param name [String] @param abbreviation [String] @param url [String] @TODO identifier

Calls superclass method IsoBibItem::Contributor::new
# File lib/iso_bib_item/organization.rb, line 50
def initialize(name:, abbreviation: nil, url: nil, identifiers: [])
  super(url: url)
  @name = name.is_a?(Array) ? name.map { |n| hash2locstr(n) } : [hash2locstr(name)]
  @abbreviation = LocalizedString.new abbreviation
  @identifiers  = identifiers
end

Public Instance Methods

hash2locstr(name) click to toggle source
# File lib/iso_bib_item/organization.rb, line 42
def hash2locstr(name)
  name.is_a?(Hash) ? LocalizedString.new(name[:content], name[:language], name[:script]) : LocalizedString.new(name)
end
to_xml(builder) click to toggle source

@param builder [Nokogiri::XML::Builder]

Calls superclass method IsoBibItem::Contributor#to_xml
# File lib/iso_bib_item/organization.rb, line 58
def to_xml(builder)
  builder.organization do
    name.each do |n|
      builder.name { |b| n.to_xml b }
    end
    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