Module: StarkParameters
- Defined in:
- lib/stark_parameters.rb,
lib/stark_parameters/version.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/stark_parameters.rb', line 7 def self.included(klass) klass.send :extend, ClassMethods klass.permitted_params = [] klass.presence_required_params = [] klass.presence_optional_params = [] klass.aliases = {} end |
Instance Method Details
#initialize(*params) ⇒ Object
15 16 17 18 19 |
# File 'lib/stark_parameters.rb', line 15 def initialize(*params) @params = params.each_with_object(make_strong_parameter({})) do |p, hash| hash.merge!(make_strong_parameter(p)) end end |
#params ⇒ Object
21 22 23 |
# File 'lib/stark_parameters.rb', line 21 def params make_strong_parameter(permitted_params.merge(required_params)).permit! end |