class Gammo::XPath::AST::Function::SubstringBefore

@!visibility private

Public Instance Methods

evaluate(context) click to toggle source
# File lib/gammo/xpath/ast/function.rb, line 137
def evaluate(context)
  s1 = arguments[0].evaluate(context).to_s
  s2 = arguments[1].evaluate(context.clone).to_s
  return string '' if s2.empty?
  return string '' unless pos = s1.index(s2)
  string s1[0...pos]
end