Module: RegexpExamples::GroupWithIgnoreCase
- Included in:
- CharGroup, SingleCharGroup
- Defined in:
- lib/regexp-examples/groups.rb
Overview
A helper method for mixing in to Group classes… Needed for generating a complete results set when the ignorecase regexp option has been set
Instance Attribute Summary collapse
-
#ignorecase ⇒ Object
readonly
Returns the value of attribute ignorecase.
Instance Method Summary collapse
Instance Attribute Details
#ignorecase ⇒ Object (readonly)
Returns the value of attribute ignorecase.
27 28 29 |
# File 'lib/regexp-examples/groups.rb', line 27 def ignorecase @ignorecase end |
Instance Method Details
#result ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/regexp-examples/groups.rb', line 28 def result group_result = super if ignorecase group_result .to_a # In case of lazy enumerator .concat(group_result.to_a.map(&:swapcase)) .uniq else group_result end end |