Class: IsoBibItem::ContributorRole

Inherits:
Object
  • Object
show all
Defined in:
lib/iso_bib_item/contribution_info.rb

Overview

Contributor’s role.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, description = []) ⇒ ContributorRole

Returns a new instance of ContributorRole.

Parameters:

  • type (String)

    allowed types “author”, “editor”, “cartographer”, “publisher”

  • description (Array<String>) (defaults to: [])


18
19
20
21
# File 'lib/iso_bib_item/contribution_info.rb', line 18

def initialize(type, description = [])
  @type = type
  @description = description.map { |d| FormattedString.new d }
end

Instance Attribute Details

#descriptionArray<IsoBibItem::FormattedString> (readonly)



10
11
12
# File 'lib/iso_bib_item/contribution_info.rb', line 10

def description
  @description
end

#typeContributorRoleType (readonly)

Returns:

  • (ContributorRoleType)


13
14
15
# File 'lib/iso_bib_item/contribution_info.rb', line 13

def type
  @type
end

Instance Method Details

#to_xml(builder) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/iso_bib_item/contribution_info.rb', line 23

def to_xml(builder)
  builder.role(type: type) do
    description.each do |d|
      builder.description { |desc| d.to_xml(desc) }
    end
  end
end