Module: Trxl::AvgFunction2

Defined in:
lib/trxl/trxl_grammar.rb

Instance Method Summary collapse

Instance Method Details

#eval(env = Environment.new) ⇒ Object



7089
7090
7091
# File 'lib/trxl/trxl_grammar.rb', line 7089

def eval(env = Environment.new)
  Trxl::Builtin.avg(values(env))
end

#expressionsObject



7093
7094
7095
# File 'lib/trxl/trxl_grammar.rb', line 7093

def expressions
  [ expression ] + more_expressions.elements.map { |e| e.expression }
end

#values(env) ⇒ Object



7097
7098
7099
# File 'lib/trxl/trxl_grammar.rb', line 7097

def values(env)
  expressions.map { |e| e.eval(env) }
end