Module: IceCubeModel::Base::ClassMethods

Defined in:
lib/ice_cube_model/base.rb

Instance Method Summary collapse

Instance Method Details

#repeat_parameter_mappingsObject



41
42
43
44
45
46
47
48
49
# File 'lib/ice_cube_model/base.rb', line 41

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



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/ice_cube_model/base.rb', line 51

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