class Gammo::XPath::AST::Value::VariableReference

@!visibility private

Public Instance Methods

evaluate(context) click to toggle source
# File lib/gammo/xpath/ast/value.rb, line 45
def evaluate(context)
  variables = context.variables
  # TODO: Is this correct?
  return String.new('') unless variables.key?(value.to_sym)
  ret = variables[value.to_sym]
  ret = ret.call if ret.respond_to?(:call)
  case ret
  when Integer, Float then Number.new(ret)
  else String.new(ret)
  end
end