Class: SwissMatch::Directories::Address

Inherits:
Struct
  • Object
show all
Defined in:
lib/swissmatch/directories/address.rb

Overview

Represents a swiss address. Used by directory service interfaces to return search results.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cityObject

Returns the value of attribute city

Returns:

  • (Object)

    the current value of city



10
11
12
# File 'lib/swissmatch/directories/address.rb', line 10

def city
  @city
end

#first_nameObject

Returns the value of attribute first_name

Returns:

  • (Object)

    the current value of first_name



10
11
12
# File 'lib/swissmatch/directories/address.rb', line 10

def first_name
  @first_name
end

#genderObject

Returns the value of attribute gender

Returns:

  • (Object)

    the current value of gender



10
11
12
# File 'lib/swissmatch/directories/address.rb', line 10

def gender
  @gender
end

#last_nameObject

Returns the value of attribute last_name

Returns:

  • (Object)

    the current value of last_name



10
11
12
# File 'lib/swissmatch/directories/address.rb', line 10

def last_name
  @last_name
end

#maiden_nameObject

Returns the value of attribute maiden_name

Returns:

  • (Object)

    the current value of maiden_name



10
11
12
# File 'lib/swissmatch/directories/address.rb', line 10

def maiden_name
  @maiden_name
end

#street_nameObject

Returns the value of attribute street_name

Returns:

  • (Object)

    the current value of street_name



10
11
12
# File 'lib/swissmatch/directories/address.rb', line 10

def street_name
  @street_name
end

#street_numberObject

Returns the value of attribute street_number

Returns:

  • (Object)

    the current value of street_number



10
11
12
# File 'lib/swissmatch/directories/address.rb', line 10

def street_number
  @street_number
end

#zip_codeObject

Returns the value of attribute zip_code

Returns:

  • (Object)

    the current value of zip_code



10
11
12
# File 'lib/swissmatch/directories/address.rb', line 10

def zip_code
  @zip_code
end

Instance Method Details

#family_nameString

Note:

I ([email protected]) am not sure whether “last_name (-maiden_name)” is the proper form. The output might be changed in a future version The current output is based on how tel.search.ch displays the name.

Returns The full family name, including the maiden name.

Returns:

  • (String)

    The full family name, including the maiden name.



31
32
33
# File 'lib/swissmatch/directories/address.rb', line 31

def family_name
  maiden_name ? "#{last_name} (-#{maiden_name})" : last_name
end

#full_nameString

Returns The full name, consisting of first_name and family_name.

Returns:

  • (String)

    The full name, consisting of first_name and family_name.



20
21
22
# File 'lib/swissmatch/directories/address.rb', line 20

def full_name
  "#{first_name} #{family_name}"
end

#streetString

Returns The street and street number.

Returns:

  • (String)

    The street and street number



14
15
16
# File 'lib/swissmatch/directories/address.rb', line 14

def street
  [street_name, street_number].compact.join(" ")
end

#to_sString

Returns A halfway readable textual representation.

Returns:

  • (String)

    A halfway readable textual representation



36
37
38
# File 'lib/swissmatch/directories/address.rb', line 36

def to_s
  "#{full_name}\n#{street}\n#{zip_code} #{city}"
end