Class: RegexpExamples::QuestionMarkRepeater

Inherits:
BaseRepeater show all
Defined in:
lib/regexp-examples/repeaters.rb

Overview

When a question mark is used, e.g. ‘/a?/` Equivalent to `/a0,1/`

Instance Attribute Summary

Attributes inherited from BaseRepeater

#group, #max_repeats, #min_repeats

Instance Method Summary collapse

Methods inherited from BaseRepeater

#random_result, #result

Constructor Details

#initialize(group) ⇒ QuestionMarkRepeater

Returns a new instance of QuestionMarkRepeater.



71
72
73
74
75
# File 'lib/regexp-examples/repeaters.rb', line 71

def initialize(group)
  super
  @min_repeats = 0
  @max_repeats = 1
end