Class: FbGraph::Work
- Inherits:
-
Object
- Object
- FbGraph::Work
- Includes:
- Comparison
- Defined in:
- lib/fb_graph/work.rb
Instance Attribute Summary (collapse)
-
- (Object) description
Returns the value of attribute description.
-
- (Object) employer
Returns the value of attribute employer.
-
- (Object) end_date
Returns the value of attribute end_date.
-
- (Object) location
Returns the value of attribute location.
-
- (Object) position
Returns the value of attribute position.
-
- (Object) projects
Returns the value of attribute projects.
-
- (Object) start_date
Returns the value of attribute start_date.
-
- (Object) with
Returns the value of attribute with.
Instance Method Summary (collapse)
-
- (Work) initialize(attributes = {})
constructor
A new instance of Work.
Methods included from Comparison
Constructor Details
- (Work) initialize(attributes = {})
A new instance of Work
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 |
# File 'lib/fb_graph/work.rb', line 7 def initialize(attributes = {}) @description = attributes[:description] if (employer = attributes[:employer]) @employer = Page.new(employer[:id], employer) end if (location = attributes[:location]) @location = Page.new(location[:id], location) end if (position = attributes[:position]) @position = Page.new(position[:id], position) end @projects = [] if attributes[:projects] attributes[:projects].each do |project| @projects << Project.new(project[:id], project) end end @with = [] if attributes[:with] attributes[:with].each do |user| @with << User.new(user[:id], user) end end if attributes[:start_date] && attributes[:start_date] != '0000-00' year, month = attributes[:start_date].split('-').collect(&:to_i) @start_date = if month.blank? || month == 0 Date.new(year) else Date.new(year, month) end end if attributes[:end_date] && attributes[:end_date] != '0000-00' year, month = attributes[:end_date].split('-').collect(&:to_i) @end_date = if month.blank? || month == 0 Date.new(year) else Date.new(year, month) end end end |
Instance Attribute Details
- (Object) description
Returns the value of attribute description
5 6 7 |
# File 'lib/fb_graph/work.rb', line 5 def description @description end |
- (Object) employer
Returns the value of attribute employer
5 6 7 |
# File 'lib/fb_graph/work.rb', line 5 def employer @employer end |
- (Object) end_date
Returns the value of attribute end_date
5 6 7 |
# File 'lib/fb_graph/work.rb', line 5 def end_date @end_date end |
- (Object) location
Returns the value of attribute location
5 6 7 |
# File 'lib/fb_graph/work.rb', line 5 def location @location end |
- (Object) position
Returns the value of attribute position
5 6 7 |
# File 'lib/fb_graph/work.rb', line 5 def position @position end |
- (Object) projects
Returns the value of attribute projects
5 6 7 |
# File 'lib/fb_graph/work.rb', line 5 def projects @projects end |
- (Object) start_date
Returns the value of attribute start_date
5 6 7 |
# File 'lib/fb_graph/work.rb', line 5 def start_date @start_date end |
- (Object) with
Returns the value of attribute with
5 6 7 |
# File 'lib/fb_graph/work.rb', line 5 def with @with end |