Sha256: 25972751d8844c9f87c307c71dc4b371db2bd2843c7cdc01a0e2b55ea339d8b4
Contents?: true
Size: 1.31 KB
Versions: 17
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true require 'iso_bib_item/person' # Isobib module module IsoBibItem # Contributor's role. class ContributorRole # @return [Array<IsoBibItem::FormattedString>] attr_reader :description # @return [ContributorRoleType] attr_reader :type # @param type [String] allowed types "author", "editor", # "cartographer", "publisher" # @param description [Array<String>] def initialize(type, description = []) @type = type @description = description.map { |d| FormattedString.new d } end def to_xml(builder) builder.role(type: type) do description.each do |d| builder.description { |desc| d.to_xml(desc) } end end end end # Contribution info. class ContributionInfo # @return [Array<IsoBibItem::ContributorRole>] attr_reader :role # @return # [IsoBibItem::Person, IsoBibItem::Organization, # IsoBibItem::IsoProjectGroup] attr_reader :entity # @param entity [IsoBibItem::Person, IsoBibItem::Organization, # IsoBibItem::IsoProjectGroup] # @param role [Array<String>] def initialize(entity:, role: ['publisher']) @entity = entity @role = role.map { |r| ContributorRole.new(r) } end def to_xml(builder) entity.to_xml builder end end end
Version data entries
17 entries across 17 versions & 1 rubygems