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.



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

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

Instance Method Details

#contains(string) ⇒ Object

CEL string functions



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

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

#endsWith(string) ⇒ Object



253
254
255
# File 'lib/cel/ast/elements.rb', line 253

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

#matches(pattern) ⇒ Object



261
262
263
# File 'lib/cel/ast/elements.rb', line 261

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

#startsWith(string) ⇒ Object



257
258
259
# File 'lib/cel/ast/elements.rb', line 257

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