module Fbe::Award::BTerm

def bill_to(bill)

Raises:
  • (RuntimeError) - If there's a failure processing any term

Returns:
  • (nil) -

Parameters:
  • bill (Fbe::Award::Bill) -- The bill to update
def bill_to(bill)
  case @op
  when :award
    @operands.each do |o|
      o.bill_to(bill)
    rescue StandardError => e
      raise "Failure in #{o}: #{e.message}"
    end
  when :aka
    @operands[0..-2].each do |o|
      o.bill_to(bill)
    rescue StandardError => e
      raise "Failure in #{o}: #{e.message}"
    end
  when :let, :set
    v = to_val(@operands[1], bill)
    raise "Can't #{@op.inspect} #{@operands[0].inspect} to nil" if v.nil?
    bill.set(@operands[0], v)
  when :give
    text = @operands[1]
    text = '' if text.nil?
    bill.line(to_val(@operands[0], bill), text)
  when :explain, :in
    # nothing, just ignore
  else
    raise "Unknown term '#{@op}'"
  end
end