Sha256: e5d16e79b8b2b0e2150c7447c824a6efcc5d8346ddeca0b39ff2ba10c40de11b

Contents?: true

Size: 678 Bytes

Versions: 5

Compression:

Stored size: 678 Bytes

Contents

# frozen_string_literal: true

module MobileWorkflow
  module ParamParser
    def mw_rewrite_payload_properties(model:, properties:)
      properties.each do |property|
        mw_rewrite_payload_property(model: model, model_property: property, params_property: property)
      end
    end

    def mw_rewrite_payload_property(model:, model_property:, params_property:)
      params[model][model_property] = params.dig(:payload, params_property, :answer)
    end

    def mw_rewrite_payload_array(model:, model_property:, params_property:)
      answer = params.dig(:payload, params_property, :answer)
      params[model][model_property] = answer[0] if answer
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mobile_workflow-0.12.2 app/controllers/concerns/mobile_workflow/param_parser.rb
mobile_workflow-0.12.1 app/controllers/concerns/mobile_workflow/param_parser.rb
mobile_workflow-0.12.0 app/controllers/concerns/mobile_workflow/param_parser.rb
mobile_workflow-0.11.1 app/controllers/concerns/mobile_workflow/param_parser.rb
mobile_workflow-0.11.0 app/controllers/concerns/mobile_workflow/param_parser.rb