Module: RegexpExamples::GroupWithIgnoreCase

Includes:
ForceLazyEnumerators
Included in:
CharGroup, SingleCharGroup
Defined in:
lib/regexp-examples/groups.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ForceLazyEnumerators

#force_if_lazy

Instance Attribute Details

#ignorecaseObject (readonly)

Returns the value of attribute ignorecase.



32
33
34
# File 'lib/regexp-examples/groups.rb', line 32

def ignorecase
  @ignorecase
end

Instance Method Details

#resultObject



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/regexp-examples/groups.rb', line 33

def result
  group_result = super
  if ignorecase
    group_result_array = force_if_lazy(group_result)
    group_result_array
      .concat(group_result_array.map(&:swapcase))
      .uniq
  else
    group_result
  end
end