Class: Arugula::QuantifierPart
- Includes:
- MatchNTimes
- Defined in:
- lib/arugula/parts.rb
Instance Attribute Summary
Attributes included from Wrapping
Instance Method Summary collapse
-
#initialize(before, after, *args) ⇒ QuantifierPart
constructor
A new instance of QuantifierPart.
- #to_s ⇒ Object
Methods included from MatchNTimes
Methods inherited from Part
Constructor Details
#initialize(before, after, *args) ⇒ QuantifierPart
Returns a new instance of QuantifierPart.
268 269 270 |
# File 'lib/arugula/parts.rb', line 268 def initialize(before, after, *args) super(*args, times: before..after) end |
Instance Method Details
#to_s ⇒ Object
272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/arugula/parts.rb', line 272 def to_s before = @times.begin after = @times.end quantifier_part = '{'.dup quantifier_part << before.to_s unless before == 0 quantifier_part << ',' unless before == after quantifier_part << after.to_s unless before == after || after == Float::INFINITY quantifier_part << '}' "#{wrapped}#{quantifier_part}" end |