Class: Watir::Locators::Element::SelectorBuilder::RegexpDisassembler

Inherits:
Object
  • Object
show all
Defined in:
lib/watir/locators/element/selector_builder/regexp_disassembler.rb

Instance Method Summary collapse

Constructor Details

#initialize(regexp) ⇒ RegexpDisassembler

Returns a new instance of RegexpDisassembler.


9
10
11
12
# File 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb', line 9

def initialize(regexp)
  @regexp = regexp
  @regexp_source = regexp.source
end

Instance Method Details

#substringsObject


14
15
16
17
18
19
20
# File 'lib/watir/locators/element/selector_builder/regexp_disassembler.rb', line 14

def substrings
  @substrings ||= begin
    strs = extract_strings(Regexp::Parser.parse(@regexp), [+''])
    strs.map!(&:downcase) if @regexp.casefold?
    strs.reject(&:empty?).uniq
  end
end