Class: RelatonBib::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton_bib/contributor.rb

Overview

Address class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(street:, city:, state: nil, country:, postcode: nil) ⇒ Address



54
55
56
57
58
59
60
# File 'lib/relaton_bib/contributor.rb', line 54

def initialize(street:, city:, state: nil, country:, postcode: nil)
  @street   = street
  @city     = city
  @state    = state
  @country  = country
  @postcode = postcode
end

Instance Attribute Details

#cityString (readonly)



38
39
40
# File 'lib/relaton_bib/contributor.rb', line 38

def city
  @city
end

#countryString (readonly)



44
45
46
# File 'lib/relaton_bib/contributor.rb', line 44

def country
  @country
end

#postcodeString, NilClass (readonly)



47
48
49
# File 'lib/relaton_bib/contributor.rb', line 47

def postcode
  @postcode
end

#stateString, NilClass (readonly)



41
42
43
# File 'lib/relaton_bib/contributor.rb', line 41

def state
  @state
end

#streetArray<String> (readonly)



35
36
37
# File 'lib/relaton_bib/contributor.rb', line 35

def street
  @street
end

Instance Method Details

#to_xml(doc) ⇒ Object



63
64
65
66
67
68
69
70
71
# File 'lib/relaton_bib/contributor.rb', line 63

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