Method: ApplicationJob#parse_payload

Defined in:
lib/app/jobs/application_job.rb

#parse_payloadObject

Internal: Parse the payload

payload - The payload from the class attribute

Examples

parse_payload

Assigns the class attributes from the payload



53
54
55
56
57
58
59
60
# File 'lib/app/jobs/application_job.rb', line 53

def parse_payload
  attributes = payload.is_a?(Hash) ? payload : JSON.parse(payload)
  # Set the values contained in the payload
  attributes.each_pair do |key, value|
    method = "#{key}=".to_sym
    send(method, value) if respond_to?(method)
  end
end