Module: Employer::Job

Defined in:
lib/employer/job.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/employer/job.rb', line 5

def id
  @id
end

Class Method Details

.included(base) ⇒ Object



31
32
33
# File 'lib/employer/job.rb', line 31

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#attribute_namesObject



35
36
37
# File 'lib/employer/job.rb', line 35

def attribute_names
  self.class.attribute_names
end

#serializeObject



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/employer/job.rb', line 43

def serialize
  {
    id: id,
    class: self.class.name,
    attributes: Hash[
      attribute_names.
        reject { |name| self.send(name).nil? }.
        map { |name| [name, self.send(name)] }
    ]
  }.reject { |key, value| value.nil? }
end

#try_again?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/employer/job.rb', line 39

def try_again?
  false
end