Class: IsoBibItem::CopyrightAssociation
- Inherits:
-
Object
- Object
- IsoBibItem::CopyrightAssociation
- Defined in:
- lib/iso_bib_item/bibliographic_item.rb
Overview
Copyright association.
Instance Attribute Summary collapse
- #from ⇒ Time readonly
- #owner ⇒ Isobib::ContributionInfo readonly
- #to ⇒ Time readonly
Instance Method Summary collapse
-
#initialize(owner:, from:, to: nil) ⇒ CopyrightAssociation
constructor
A new instance of CopyrightAssociation.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(owner:, from:, to: nil) ⇒ CopyrightAssociation
Returns a new instance of CopyrightAssociation.
61 62 63 64 65 66 67 |
# 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 |
Instance Attribute Details
#from ⇒ Time (readonly)
49 50 51 |
# File 'lib/iso_bib_item/bibliographic_item.rb', line 49 def from @from end |
#owner ⇒ Isobib::ContributionInfo (readonly)
55 56 57 |
# File 'lib/iso_bib_item/bibliographic_item.rb', line 55 def owner @owner end |
#to ⇒ Time (readonly)
52 53 54 |
# File 'lib/iso_bib_item/bibliographic_item.rb', line 52 def to @to end |
Instance Method Details
#to_xml(builder) ⇒ Object
69 70 71 72 73 74 75 |
# 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 |