Sha256: 246da98b0e78441f9a99234a093e5acf07868e834e6987eda3dac285a8d1dad4
Contents?: true
Size: 1.48 KB
Versions: 7
Compression:
Stored size: 1.48 KB
Contents
# frozen_string_literal: true require 'iso_bib_item/contributor' module IsoBibItem # module OrgIdentifierType # ORCID = 'orcid' # URI = 'uri' # end # Organization identifier. class OrgIdentifier # @return [String] attr_reader :type # @return [String] attr_reader :value # @param type [String] # @param value [String] def initialize(type, value) @type = type @value = value end def to_xml(builder) builder.identifier(value, type: type) end end # Organization. class Organization < Contributor # @return [IsoBibItem::LocalizedString] attr_reader :name # @return [IsoBibItem::LocalizedString] attr_reader :abbreviation # @return [Array<IsoBibItem::OrgIdentifier>] attr_reader :identifiers # @param name [String] # @param abbreviation [String] # @param url [String] def initialize(name:, abbreviation: nil, url: nil) super(url) @name = LocalizedString.new name @abbreviation = LocalizedString.new abbreviation @identifiers = [] end # rubocop:disable Metrics/AbcSize # @return [String] def to_xml(builder) builder.organization do builder.name { |b| name.to_xml b } builder.abbreviation { |a| abbreviation.to_xml a } if abbreviation builder.uri uri.to_s if uri identifiers.each { |identifier| identifier.to_xml builder } super end end # rubocop:enable Metrics/AbcSize end end
Version data entries
7 entries across 7 versions & 1 rubygems