Class: Person
- Inherits:
-
Object
- Object
- Person
- Defined in:
- lib/person.rb
Constant Summary collapse
- @@senators =
[nil]
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#city ⇒ Object
Returns the value of attribute city.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rd ⇒ Object
Returns the value of attribute rd.
-
#sd ⇒ Object
Returns the value of attribute sd.
-
#state ⇒ Object
Returns the value of attribute state.
-
#zip9 ⇒ Object
Returns the value of attribute zip9.
Instance Method Summary collapse
- #full_address ⇒ Object
- #readIn(str) ⇒ Object
- #senator ⇒ Object
- #senator_name ⇒ Object
- #senator_phone ⇒ Object
- #set_reps ⇒ Object
- #to_s ⇒ Object
- #writeOut ⇒ Object
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
2 3 4 |
# File 'lib/person.rb', line 2 def address @address end |
#city ⇒ Object
Returns the value of attribute city.
2 3 4 |
# File 'lib/person.rb', line 2 def city @city end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/person.rb', line 2 def name @name end |
#rd ⇒ Object
Returns the value of attribute rd.
2 3 4 |
# File 'lib/person.rb', line 2 def rd @rd end |
#sd ⇒ Object
Returns the value of attribute sd.
2 3 4 |
# File 'lib/person.rb', line 2 def sd @sd end |
#state ⇒ Object
Returns the value of attribute state.
2 3 4 |
# File 'lib/person.rb', line 2 def state @state end |
#zip9 ⇒ Object
Returns the value of attribute zip9.
2 3 4 |
# File 'lib/person.rb', line 2 def zip9 @zip9 end |
Instance Method Details
#full_address ⇒ Object
96 97 98 |
# File 'lib/person.rb', line 96 def full_address [self.address, self.city, self.state] * ', ' end |
#readIn(str) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/person.rb', line 36 def readIn(str) arr=str.chomp.split("\t") @name = arr[0].to_s.chomp @address = arr[1].to_s.chomp @city = arr[2].to_s.chomp @state = arr[3].to_s.chomp @zip9 = arr[4].to_s.chomp @SD = arr[5].to_s.chomp @RD = arr[6].to_s.chomp end |
#senator ⇒ Object
87 88 89 |
# File 'lib/person.rb', line 87 def senator @senator ||= @@senators[self.sd.to_i] end |
#senator_name ⇒ Object
93 94 95 |
# File 'lib/person.rb', line 93 def senator_name @senator_name ||= senator[:name] if senator end |
#senator_phone ⇒ Object
90 91 92 |
# File 'lib/person.rb', line 90 def senator_phone @senator_phone ||= senator[:phone] if senator end |
#set_reps ⇒ Object
81 82 83 84 85 86 |
# File 'lib/person.rb', line 81 def set_reps r = reps self self.rd = r[:rd] self.sd = r[:sd] r end |
#to_s ⇒ Object
78 79 80 |
# File 'lib/person.rb', line 78 def to_s self.writeOut end |
#writeOut ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/person.rb', line 47 def writeOut() str = "" if (@name) str+=@name str+="\t" end if (@address) str+=@address str+="\t" end if (@city) str+=@city str+="\t" end if (@state) str+=@state str+="\t" end if (@zip9) str+=@zip9 str+="\t" end if (@sd) str+=@sd str+="\t" end if (@rd) str+=@rd end return str.chomp; end |