Class: DRP::Weights::ProcStaticWeight

Inherits:
StaticWeight show all
Defined in:
lib/weights_and_max_depths.rb

Instance Attribute Summary

Attributes inherited from StaticWeight

#value

Instance Method Summary collapse

Methods inherited from AbstractWeight

factory

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.next_meta_codon
  else
    @value = proc.call *Array.new(ar) { inst.next_meta_codon }
  end
end