Class: Cel::String

Inherits:
Literal
  • Object
show all
Defined in:
lib/cel/ast/elements.rb

Instance Attribute Summary

Attributes inherited from Literal

#type, #value

Instance Method Summary collapse

Methods inherited from Literal

#==, to_cel_type, #to_ruby_type

Constructor Details

#initialize(value) ⇒ String

Returns a new instance of String.



232
233
234
# File 'lib/cel/ast/elements.rb', line 232

def initialize(value)
  super(:string, value)
end

Instance Method Details

#contains(string) ⇒ Object

CEL string functions



238
239
240
# File 'lib/cel/ast/elements.rb', line 238

def contains(string)
  Bool.new(@value.include?(string))
end

#endsWith(string) ⇒ Object



242
243
244
# File 'lib/cel/ast/elements.rb', line 242

def endsWith(string)
  Bool.new(@value.end_with?(string))
end

#matches(pattern) ⇒ Object



250
251
252
# File 'lib/cel/ast/elements.rb', line 250

def matches(pattern)
  Macro.matches(self, pattern)
end

#startsWith(string) ⇒ Object



246
247
248
# File 'lib/cel/ast/elements.rb', line 246

def startsWith(string)
  Bool.new(@value.start_with?(string))
end