Class: RegexpExamples::DotGroup

Inherits:
Object
  • Object
show all
Includes:
RandomResultBySample
Defined in:
lib/regexp-examples/groups.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RandomResultBySample

#random_result

Methods included from ForceLazyEnumerators

#force_if_lazy

Constructor Details

#initialize(multiline) ⇒ DotGroup

Returns a new instance of DotGroup.



95
96
97
# File 'lib/regexp-examples/groups.rb', line 95

def initialize(multiline)
  @multiline = multiline
end

Instance Attribute Details

#multilineObject (readonly)

Returns the value of attribute multiline.



94
95
96
# File 'lib/regexp-examples/groups.rb', line 94

def multiline
  @multiline
end

Instance Method Details

#resultObject



99
100
101
102
103
104
# File 'lib/regexp-examples/groups.rb', line 99

def result
  chars = multiline ? CharSets::Any : CharSets::AnyNoNewLine
  chars.lazy.map do |result|
    GroupResult.new(result)
  end
end