Class: RegexpExamples::OneTimeRepeater

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

Overview

When there is “no repeater”, we interpret this as a “one time repeater”. For example, ‘/a/` is a “OneTimeRepeater” of “a” Equivalent to `/a1/`

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) ⇒ OneTimeRepeater

Returns a new instance of OneTimeRepeater.



41
42
43
44
45
# File 'lib/regexp-examples/repeaters.rb', line 41

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