Class: IsoBibItem::ContributorRole
- Inherits:
-
Object
- Object
- IsoBibItem::ContributorRole
- Defined in:
- lib/iso_bib_item/contribution_info.rb
Overview
Contributor’s role.
Instance Attribute Summary collapse
- #description ⇒ Array<IsoBibItem::FormattedString> readonly
- #type ⇒ ContributorRoleType readonly
Instance Method Summary collapse
-
#initialize(*args) ⇒ ContributorRole
constructor
A new instance of ContributorRole.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(*args) ⇒ ContributorRole
Returns a new instance of ContributorRole.
18 19 20 21 |
# File 'lib/iso_bib_item/contribution_info.rb', line 18 def initialize(*args) @type = args.fetch 0 @description = args.fetch(1, []).map { |d| FormattedString.new content: d, type: nil } end |
Instance Attribute Details
#description ⇒ Array<IsoBibItem::FormattedString> (readonly)
10 11 12 |
# File 'lib/iso_bib_item/contribution_info.rb', line 10 def description @description end |
#type ⇒ ContributorRoleType (readonly)
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 |