matschaffer / friends

The app I came out with after working through the ADC MacRuby tutorial

This URL has Read+Write access

friends / friend.rb
100644 26 lines (21 sloc) 0.442 kb
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
#
# friend.rb
# Friends
#
# Created by Mat Schaffer on 10/31/08.
# Copyright (c) 2008 Mat Schaffer. All rights reserved.
#
 
class Friend
KEYS = [:first_name, :last_name, :phone_number, :email_address]
KEYS.each { |k| attr_accessor k }
 
def initialize(*args)
args.last.each { |k, v| send("#{k}=", v) } if args.last
end
 
def from_row(row)
i = 0
p i
end
 
def to_row
KEYS.inject([]) { |row, key| row << send(key) }
end
end