Class: Capybara::Selector::RegexpDisassembler::Expression Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/capybara/selector/regexp_disassembler.rb |
Class Method Summary
- .new(exp) ⇒ Expression constructor Internal use only
Instance Attribute Summary
- #fixed_repeat? ⇒ Boolean readonly private Internal use only
- #indeterminate? ⇒ Boolean readonly private Internal use only
Instance Method Summary
- #extract_strings(process_alternatives) Internal use only
- #alternatives private Internal use only
- #each private Internal use only
- #max_repeat private Internal use only
- #min_repeat private Internal use only
- #options_set(strs) private Internal use only
- #repeat_set(str) private Internal use only
- #type private Internal use only
Constructor Details
.new(exp) ⇒ Expression
# File 'lib/capybara/selector/regexp_disassembler.rb', line 93
def initialize(exp) @exp = exp end
Instance Attribute Details
#fixed_repeat? ⇒ Boolean
(readonly, private)
# File 'lib/capybara/selector/regexp_disassembler.rb', line 180
def fixed_repeat? min_repeat == max_repeat end
#indeterminate? ⇒ Boolean
(readonly, private)
# File 'lib/capybara/selector/regexp_disassembler.rb', line 168
def indeterminate? %i[meta set].include?(type) end
Instance Method Details
#alternatives (private)
[ GitHub ]# File 'lib/capybara/selector/regexp_disassembler.rb', line 200
def alternatives @exp.alternatives.map { |exp| Expression.new(exp) } end
#each (private)
[ GitHub ]# File 'lib/capybara/selector/regexp_disassembler.rb', line 204
def each @exp.each { |exp| yield Expression.new(exp) } end
#extract_strings(process_alternatives)
[ GitHub ]# File 'lib/capybara/selector/regexp_disassembler.rb', line 97
def extract_strings(process_alternatives) strings = [] each do |exp| next if exp.ignore? next strings.push(nil) if exp.optional? && !process_alternatives next strings.push(exp.alternative_strings) if exp.alternation? && process_alternatives strings.concat(exp.strings(process_alternatives)) end strings end
#max_repeat (private)
[ GitHub ]# File 'lib/capybara/selector/regexp_disassembler.rb', line 176
def max_repeat @exp.repetitions.end end
#min_repeat (private)
[ GitHub ]# File 'lib/capybara/selector/regexp_disassembler.rb', line 172
def min_repeat @exp.repetitions.begin end
#options_set(strs) (private)
[ GitHub ]# File 'lib/capybara/selector/regexp_disassembler.rb', line 194
def (strs) strs = [Set.new([[''], Array(strs)])] strs.push(nil) unless max_repeat == 1 strs end
#repeat_set(str) (private)
[ GitHub ]# File 'lib/capybara/selector/regexp_disassembler.rb', line 188
def repeat_set(str) strs = Array(str * min_repeat) strs.push(nil) unless fixed_repeat? strs end
#type (private)
[ GitHub ]# File 'lib/capybara/selector/regexp_disassembler.rb', line 184
def type @exp.type end