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

Constructor Details

#initialize(value) ⇒ String

Returns a new instance of String.



223
224
225
# File 'lib/cel/ast/elements.rb', line 223

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

Instance Method Details

#contains(string) ⇒ Object

CEL string functions



229
230
231
# File 'lib/cel/ast/elements.rb', line 229

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

#endsWith(string) ⇒ Object



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

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

#matches(pattern) ⇒ Object



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

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

#startsWith(string) ⇒ Object



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

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