Class: RegexpExamples::RangeRepeater
- Inherits:
-
BaseRepeater
- Object
- BaseRepeater
- RegexpExamples::RangeRepeater
- Defined in:
- lib/regexp-examples/repeaters.rb
Instance Attribute Summary
Attributes inherited from BaseRepeater
Instance Method Summary collapse
-
#initialize(group, min, has_comma, max) ⇒ RangeRepeater
constructor
A new instance of RangeRepeater.
- #result ⇒ Object
Constructor Details
#initialize(group, min, has_comma, max) ⇒ RangeRepeater
Returns a new instance of RangeRepeater.
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/regexp-examples/repeaters.rb', line 65 def initialize(group, min, has_comma, max) super(group) @min = min || 0 if max # Prevent huge number of results in case of e.g. /.{1,100}/.examples @max = smallest(max, @min + RegexpExamples.MaxRepeaterVariance) elsif has_comma @max = @min + RegexpExamples.MaxRepeaterVariance else @max = @min end end |
Instance Method Details
#result ⇒ Object
78 79 80 |
# File 'lib/regexp-examples/repeaters.rb', line 78 def result super(@min, @max) end |