class ParamsModifier::Base
Base
class for params modifier
Public Class Methods
new(attributes)
click to toggle source
# File lib/params_modifier/base.rb, line 8 def initialize(attributes) @attributes = attributes end
parameter(param_name, &block)
click to toggle source
# File lib/params_modifier/base.rb, line 4 def self.parameter(param_name, &block) define_method "_parameter_#{param_name}".to_sym, &block end
Public Instance Methods
call()
click to toggle source
# File lib/params_modifier/base.rb, line 12 def call @attributes.each do |key, value| method_name = "_parameter_#{key}" @attributes[key] = send(method_name, value) if respond_to?(method_name) end end