Module: Employer::Job::ClassMethods
- Defined in:
- lib/employer/job.rb
Instance Method Summary collapse
Instance Method Details
#attribute(name) ⇒ Object
8 9 10 11 12 13 14 |
# 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 ⇒ Object
16 17 18 |
# File 'lib/employer/job.rb', line 16 def attribute_names @attribute_names ||= [] end |
#deserialize(serialized_job) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# 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 |