Class: RubyARES::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-ares/address.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, street, postcode, city, city_part, house_number, house_number_type, orientational_number) ⇒ Address

Returns a new instance of Address.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ruby-ares/address.rb', line 14

def initialize(id, street, postcode, city, city_part,
               house_number, house_number_type, orientational_number)
  @id = id
  @street = street
  @postcode = postcode
  @city = city
  @city_part = city_part
  @house_number = house_number
  @house_number_type = house_number_type
  @orientational_number = orientational_number
end

Instance Attribute Details

#cityObject (readonly)

ID_adresy



5
6
7
# File 'lib/ruby-ares/address.rb', line 5

def city
  @city
end

#city_partObject (readonly)

ID_adresy



5
6
7
# File 'lib/ruby-ares/address.rb', line 5

def city_part
  @city_part
end

#house_numberObject (readonly)

ID_adresy



5
6
7
# File 'lib/ruby-ares/address.rb', line 5

def house_number
  @house_number
end

#house_number_typeObject (readonly)

ID_adresy



5
6
7
# File 'lib/ruby-ares/address.rb', line 5

def house_number_type
  @house_number_type
end

#idObject (readonly)

ID_adresy



5
6
7
# File 'lib/ruby-ares/address.rb', line 5

def id
  @id
end

#orientational_numberObject (readonly)

ID_adresy



5
6
7
# File 'lib/ruby-ares/address.rb', line 5

def orientational_number
  @orientational_number
end

#postcodeObject (readonly)

ID_adresy



5
6
7
# File 'lib/ruby-ares/address.rb', line 5

def postcode
  @postcode
end

#streetObject (readonly)

ID_adresy



5
6
7
# File 'lib/ruby-ares/address.rb', line 5

def street
  @street
end

Instance Method Details

#city_lineObject



47
48
49
# File 'lib/ruby-ares/address.rb', line 47

def city_line
  "#{@postcode} #{@city}"
end

#street_lineObject



43
44
45
# File 'lib/ruby-ares/address.rb', line 43

def street_line
  "#{@street} #{street_number}"
end

#street_numberObject



35
36
37
38
39
40
41
# File 'lib/ruby-ares/address.rb', line 35

def street_number
  unless @orientational_number
    @house_number
  else
    "#{@orientational_number}/#{@house_number}"
  end
end

#to_strObject



26
27
28
29
30
31
32
33
# File 'lib/ruby-ares/address.rb', line 26

def to_str
  @city_part = '' if @city == @city_part
<<EOF
#{self.street} #{self.street_number}
#{self.postcode} #{self.city}
#{self.city_part}
EOF
end