Class: RegexpExamples::DotGroup

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

Overview

A special case of CharGroup, for the pattern /./ (For example, we never need to care about ignorecase here!)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RandomResultBySample

#random_result

Constructor Details

#initialize(multiline) ⇒ DotGroup

Returns a new instance of DotGroup.



103
104
105
# File 'lib/regexp-examples/groups.rb', line 103

def initialize(multiline)
  @multiline = multiline
end

Instance Attribute Details

#multilineObject (readonly)

Returns the value of attribute multiline.



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

def multiline
  @multiline
end

Instance Method Details

#resultObject



107
108
109
110
111
112
# File 'lib/regexp-examples/groups.rb', line 107

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