class IsoBibItem::CopyrightAssociation

Copyright association.

Attributes

from[R]

@return [Time]

owner[R]

@return [Isobib::ContributionInfo]

to[R]

@return [Time]

Public Class Methods

new(owner:, from:, to: nil) click to toggle source

@param owner [Hash{name=>String, abbreviation=>String, url=>String}]

contributor

@param from [String] date @param to [String] date

# File lib/iso_bib_item/bibliographic_item.rb, line 61
def initialize(owner:, from:, to: nil)
  @owner = if owner.is_a?(Hash)
             ContributionInfo.new entity: Organization.new(owner)
           else owner end
  @from  = Time.strptime(from, '%Y') unless from.empty?
  @to    = Time.parse(to) if to
end

Public Instance Methods

to_xml(builder) click to toggle source
# File lib/iso_bib_item/bibliographic_item.rb, line 69
def to_xml(builder)
  builder.copyright do
    builder.from from.year
    builder.to to.year if to
    builder.owner { owner.to_xml builder }
  end
end