module DATA

Public Class Methods

choose(which) click to toggle source

Singleton method that chooses a given set of constants. Constants starting with “K” are considered rate constants in min⁻¹. All values are converted to floats (Using to_f method). Using eval, the keys are defined as constants in the top namespace.

# File lib/cell_cycle/virginia_tech/parameters.rb, line 128
def DATA.choose which
  keys.each { |key|
    a = [ "DATA[:#{key}][:#{which}]" ]
    # Symbols started with "K" are converted from min⁻¹ to num. values in s⁻¹
    x = if "#{key}"[0] == "K" then ".min⁻¹.in :s⁻¹" end
    # This version replaces nils with zeroes:
    eval "#{key} = %s.to_f#{x}" % a
    # This version keeps nils:
    # eval "#{key} = if %s.is_a? Numeric then %s.to_f#{x} else %s end" % ( a * 3 )
  }
end