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.



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

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

Instance Method Details

#substringsObject



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

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