Class: DecisionAgent::Dmn::Feel::Functions::SubstringBefore

Inherits:
Base
  • Object
show all
Defined in:
lib/decision_agent/dmn/feel/functions.rb

Class Method Summary collapse

Methods inherited from Base

register, validate_arg_count

Class Method Details

.call(args, _context = {}) ⇒ Object



123
124
125
126
127
128
129
# File 'lib/decision_agent/dmn/feel/functions.rb', line 123

def self.call(args, _context = {})
  validate_arg_count(args, 2)
  str = args[0].to_s
  match = args[1].to_s
  idx = str.index(match)
  idx ? str[0...idx] : ""
end