Class: Regex::Repetition

Inherits:
MonadicExpression show all
Defined in:
lib/regex/repetition.rb

Overview

Represents the repetition of a child element. The number of repetitions is constrained by the multiplicity

Instance Attribute Summary collapse

Attributes inherited from MonadicExpression

#child

Attributes inherited from Expression

#begin_anchor, #end_anchor

Instance Method Summary collapse

Methods inherited from MonadicExpression

#done!

Methods inherited from CompoundExpression

#atomic?

Methods inherited from Expression

#atomic?, #options, #to_str

Constructor Details

#initialize(childExpressionToRepeat, aMultiplicity) ⇒ Repetition

Constructor.

Parameters:



15
16
17
18
# File 'lib/regex/repetition.rb', line 15

def initialize(childExpressionToRepeat, aMultiplicity)
  super(childExpressionToRepeat)
  @multiplicity = aMultiplicity
end

Instance Attribute Details

#multiplicityRegex::Multiplicity (readonly)

Returns:



10
11
12
# File 'lib/regex/repetition.rb', line 10

def multiplicity
  @multiplicity
end

Instance Method Details

#lazy!Object

Apply the lazy flag.



21
22
23
24
# File 'lib/regex/repetition.rb', line 21

def lazy!
  multiplicity.policy = :lazy
  super
end