Class: Capybara::Selector::RegexpDisassembler Private

Inherits:
Object
  • Object
show all
Defined in:
lib/capybara/selector/regexp_disassembler.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(regexp) ⇒ RegexpDisassembler

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RegexpDisassembler.



9
10
11
# File 'lib/capybara/selector/regexp_disassembler.rb', line 9

def initialize(regexp)
  @regexp = regexp
end

Instance Method Details

#substringsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
17
18
19
# File 'lib/capybara/selector/regexp_disassembler.rb', line 13

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