module Employer::Job::ClassMethods

Public Instance Methods

attribute(name) click to toggle source
# File lib/employer/job.rb, line 8
def attribute(name)
  name = name.to_sym
  unless attribute_names.include?(name)
    attribute_names << name
    attr_accessor name
  end
end
attribute_names() click to toggle source
# File lib/employer/job.rb, line 16
def attribute_names
  @attribute_names ||= []
end
deserialize(serialized_job) click to toggle source
# File lib/employer/job.rb, line 20
def deserialize(serialized_job)
  raise Employer::Errors::JobClassMismatch unless serialized_job[:class] == self.name
  job = new
  job.id = serialized_job[:id]
  serialized_job[:attributes].each_pair do |attribute, value|
    job.public_send("#{attribute}=", value)
  end
  job
end