Class: IsoBibItem::Address
- Inherits:
-
Object
- Object
- IsoBibItem::Address
- Defined in:
- lib/iso_bib_item/contributor.rb
Overview
Address class.
Instance Attribute Summary collapse
- #city ⇒ String readonly
- #country ⇒ String readonly
- #postcode ⇒ String, NilClass readonly
- #state ⇒ String, NilClass readonly
- #street ⇒ Array<String> readonly
Instance Method Summary collapse
-
#initialize(street:, city:, state: nil, country:, postcode: nil) ⇒ Address
constructor
A new instance of Address.
- #to_xml(doc) ⇒ Object
Constructor Details
#initialize(street:, city:, state: nil, country:, postcode: nil) ⇒ Address
Returns a new instance of Address.
28 29 30 31 32 33 34 |
# File 'lib/iso_bib_item/contributor.rb', line 28 def initialize(street:, city:, state: nil, country:, postcode: nil) @street = street @city = city @state = state @country = country @postcode = postcode end |
Instance Attribute Details
#city ⇒ String (readonly)
12 13 14 |
# File 'lib/iso_bib_item/contributor.rb', line 12 def city @city end |
#country ⇒ String (readonly)
18 19 20 |
# File 'lib/iso_bib_item/contributor.rb', line 18 def country @country end |
#postcode ⇒ String, NilClass (readonly)
21 22 23 |
# File 'lib/iso_bib_item/contributor.rb', line 21 def postcode @postcode end |
#state ⇒ String, NilClass (readonly)
15 16 17 |
# File 'lib/iso_bib_item/contributor.rb', line 15 def state @state end |
#street ⇒ Array<String> (readonly)
9 10 11 |
# File 'lib/iso_bib_item/contributor.rb', line 9 def street @street end |
Instance Method Details
#to_xml(doc) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/iso_bib_item/contributor.rb', line 37 def to_xml(doc) doc.address do street.each { |str| doc.street str } doc.city city doc.state state if state doc.country country doc.postcode postcode if postcode end end |