Class: DRP::Weights::ProcStaticWeight
- Inherits:
-
StaticWeight
- Object
- AbstractWeight
- StaticWeight
- DRP::Weights::ProcStaticWeight
- Defined in:
- lib/weights_and_max_depths.rb
Instance Attribute Summary
Attributes inherited from StaticWeight
Instance Method Summary collapse
-
#initialize(args) ⇒ ProcStaticWeight
constructor
A new instance of ProcStaticWeight.
Methods inherited from AbstractWeight
Constructor Details
#initialize(args) ⇒ ProcStaticWeight
Returns a new instance of ProcStaticWeight.
129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/weights_and_max_depths.rb', line 129 def initialize args proc = args.user_args ar = proc.arity inst = args.drp_instance if ar <= 0 @value = proc.call elsif ar == 1 @value = proc.call inst. else @value = proc.call *Array.new(ar) { inst. } end end |