Sha256: 36c747402ed52ab58588570d05766808186a1901dc65618e7239e601f08998bd

Contents?: true

Size: 847 Bytes

Versions: 3

Compression:

Stored size: 847 Bytes

Contents

module FbGraph
  class Work
    include FbGraph::Comparison

    attr_accessor :employer, :location, :position, :start_date, :end_date

    def initialize(attributes = {})
      if (employer = attributes[:employer])
        @employer = FbGraph::Page.new(employer.delete(:id), employer)
      end
      if (location = attributes[:location])
        @location = FbGraph::Page.new(location.delete(:id), location)
      end
      if (position = attributes[:position])
        @position = FbGraph::Page.new(position.delete(:id), position)
      end
      if attributes[:start_date]
        @start_date = Date.new(*attributes[:start_date].split('-').collect(&:to_i))
      end
      if attributes[:end_date] && attributes[:end_date] != '0000-00'
        @end_date = Date.new(*attributes[:end_date].split('-').collect(&:to_i))
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fb_graph-0.1.1 lib/fb_graph/work.rb
fb_graph-0.1.0 lib/fb_graph/work.rb
fb_graph-0.0.8 lib/fb_graph/work.rb