Class: Archsight::Query::AST::RegexValue

Inherits:
Object
  • Object
show all
Defined in:
lib/archsight/query/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern, flags = "") ⇒ RegexValue

Returns a new instance of RegexValue.



269
270
271
272
# File 'lib/archsight/query/ast.rb', line 269

def initialize(pattern, flags = "")
  @pattern = pattern
  @flags = flags
end

Instance Attribute Details

#flagsObject (readonly)

Returns the value of attribute flags.



267
268
269
# File 'lib/archsight/query/ast.rb', line 267

def flags
  @flags
end

#patternObject (readonly)

Returns the value of attribute pattern.



267
268
269
# File 'lib/archsight/query/ast.rb', line 267

def pattern
  @pattern
end

Instance Method Details

#to_regexpObject



274
275
276
277
# File 'lib/archsight/query/ast.rb', line 274

def to_regexp
  options = @flags.include?("i") ? Regexp::IGNORECASE : 0
  Regexp.new(@pattern, options)
end