-
-
Notifications
You must be signed in to change notification settings - Fork 191
/
education.rb
32 lines (30 loc) · 885 Bytes
/
education.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
module FbGraph
class Education
include Comparison
attr_accessor :school, :degree, :year, :concentration, :classes, :type
def initialize(attributes = {})
if (school = attributes[:school])
@school = Page.new(school[:id], school)
end
if (degree = attributes[:degree])
@degree = Page.new(degree[:id], degree)
end
if (year = attributes[:year])
@year = Page.new(year[:id], year)
end
@concentration = []
if attributes[:concentration]
attributes[:concentration].each do |concentration|
@concentration << Page.new(concentration[:id], concentration)
end
end
@classes = []
if attributes[:classes]
attributes[:classes].each do |klass|
@classes << Klass.new(klass[:id], klass)
end
end
@type = attributes[:type]
end
end
end