-
Notifications
You must be signed in to change notification settings - Fork 0
/
Contacts02-26-14.rb
188 lines (145 loc) · 3.3 KB
/
Contacts02-26-14.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
class Contact
#initialize
@@no_of_contacts=0
def initialize(email, name, addr,town,state, zip, btel, ptel, pemail,title,company)
@contact_id=email
@contact_name=name
@contact_addr=addr
@contact_town=town
@contact_state=state
@contact_zip=zip
@contact_btel=btel
@contact_ptel=ptel
@contact_pemail=pemail
@contact_title=title
@contact_company=company
end
#Setter Methods:
def email=(em)
@contact_id=em
end
def name=(nm)
@contact_name=nm
end
def addr=(ad)
@contact_addr=ad
end
def town=(tn)
@contact_town=tn
end
def state=(stat)
@contact_state=stat
end
def zip=(zp)
@contact_zip=zp
end
def btel=(bt)
@contact_state=bt
end
def ptel=(pt)
@contact_ptel=pt
end
def pemail=(pe)
@contact_pemail=pe
end
def title=(ti)
@contact_title=ti
end
def company=(co)
@contact_company=co
end
#Getter Methods:
def email
puts @contact_id
@contactEmailString=@contact_id.to_s
puts `echo #{@contactEmailString} | clip`
end
def name
puts @contact_name
@contactNameString=@contact_name.to_s
puts `echo #{@contactNameString} | clip`
end
def nameStr
@contactNameString1=@contact_name.to_s
end
def nameStrFirst
@contactNameString=@contact_name.to_s
@loc=@contactNameString=~/\s/
@fname=@contactNameString[0,@loc]
puts `echo #{@fname} | clip`
end
def nameStrLast
@contactNameString=@contact_name.to_s
@loc=@contactNameString=~/\s/
@lname=@contactNameString[@loc+1,@contactNameString.length-(@loc+1)]
puts `echo #{@lname} | clip`
end
def addr
puts @contact_addr
@contactAddrString=@contact_addr.to_s
puts `echo #{@contactAddrString} | clip`
end
def town
puts @contact_town
@contactTownString=@contact_town.to_s
puts `echo #{@contactTownString} | clip`
end
def state
puts @contact_state
@contactStateString=@contact_state.to_s
puts `echo #{@contactStateString} | clip`
end
def zip
puts @contact_zip
@contactZipString=@contact_zip.to_s
puts `echo #{@contactZipString} | clip`
end
def btel
puts @contact_btel
@contactBtelString=@contact_btel.to_s
puts `echo #{@contactBtelString} | clip`
end
def ptel
puts @contact_ptel
@contactPtelString=@contact_ptel.to_s
puts `echo #{@contactPtelString} | clip`
end
def pemail
puts @contact_pemail
@contactPemailString=@contact_pemail.to_s
puts `echo #{@contactPemailString} | clip`
end
def title
puts @contact_title
@contactTitleString=@contact_title.to_s
puts `echo #{@contactTitleString} | clip`
end
def company
puts @contact_company
@contactCompanyString=@contact_company.to_s
puts `echo #{@contactCompanyString} | clip`
end
end
=begin
ray=Contact.new("[email protected]", #email
"Ray Nieva",#name
"280 Lincoln St ",#addr
"Allston",#town
"MA ",#state
"01234",#zip
"617-275-8430 x148",#btel
"978-763-5277",#ptel
"raynieva@gmail")#pemail
=end
=begin
aname=Contact.new("", #email
"",#name
"",#addr
"",#town
"",#state
"",#zip
"",#btel
"",#ptel
"",#pemail
"")#title
=end