module Fbe::Award::BTerm

def to_val(any, bill)

Raises:
  • (RuntimeError) - If a symbol isn't found in the bill

Returns:
  • (Object) - The evaluated value

Parameters:
  • bill (Fbe::Award::Bill) -- The bill providing context for evaluation
  • any (Object) -- The value to evaluate (symbol, term, or literal)
def to_val(any, bill)
  if any.is_a?(BTerm)
    any.calc(bill)
  elsif any.is_a?(Symbol)
    v = bill.vars[any]
    raise "Unknown name #{any.inspect} among: #{bill.vars.keys.map(&:inspect).joined}" if v.nil?
    v
  else
    any
  end
end