Class: MemDB::RegexpEngines::Std

Inherits:
Object
  • Object
show all
Defined in:
lib/mem_db/regexp_engines/std.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, ignore_case: false) ⇒ Std

Returns a new instance of Std.



10
11
12
13
14
15
# File 'lib/mem_db/regexp_engines/std.rb', line 10

def initialize(source, ignore_case: false)
  opts = ::Regexp::MULTILINE
  opts |= ::Regexp::IGNORECASE if ignore_case

  @rx = ::Regexp.new(source, opts)
end

Class Method Details

.quote(str) ⇒ Object



6
7
8
# File 'lib/mem_db/regexp_engines/std.rb', line 6

def self.quote(str)
  ::Regexp.quote(str)
end

Instance Method Details

#match?(str) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/mem_db/regexp_engines/std.rb', line 17

def match?(str)
  @rx.match?(str)
end