Sha256: fe6adee1725389b96ffcbeee57a202f43d4bed8329df6fb31a372f7b8a1f04a1

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 Bytes

Contents

module Axel
  class ControllerParameters
    private
    attr_accessor :controller_params

    public

    def initialize(controller_params)
      self.controller_params = controller_params
    end

    def params_object
      strong_params? ? params_class.new(controller_params) : controller_params
    end

    def params_class # testability
      ActionController::Parameters
    end
    private :params_class

    def strong_module
      ActionController::StrongParameters
    end

    def strong_params?
      !!(params_class && strong_module)
    rescue
      false
    end
    private :strong_params?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axel-0.0.1 lib/axel/controller_parameters.rb