Module: IceCubeModel::Base::ClassMethods

Defined in:
lib/ice_cube_model/base.rb

Instance Method Summary collapse

Instance Method Details

#repeat_parameter_mappingsObject



34
35
36
37
38
39
40
41
42
# File 'lib/ice_cube_model/base.rb', line 34

def repeat_parameter_mappings
  @repeat_parameter_mappings ||= begin
    if superclass.respond_to?(:repeat_parameter_mappings)
      superclass.repeat_parameter_mappings.dup
    else
      {}
    end
  end
end

#with_repeat_param(param_name, replacement) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/ice_cube_model/base.rb', line 44

def with_repeat_param(param_name, replacement)
  repeat_parameter_mappings[param_name] = param_sym = "ice_cube_model #{param_name}".to_sym
  if replacement.is_a?(::Proc)
    define_method(param_sym) do
      replacement.call
    end
  else
    define_method(param_sym) do
      send(replacement)
    end
  end
end