class Regex::Repetition

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

Attributes

multiplicity[R]

@return [Regex::Multiplicity]

Public Class Methods

new(childExpressionToRepeat, aMultiplicity) click to toggle source

Constructor. @param childExpressionToRepeat [Regex::Expression] @param aMultiplicity [Regex::Multiplicity]

Calls superclass method Regex::MonadicExpression::new
# File lib/regex/repetition.rb, line 17
def initialize(childExpressionToRepeat, aMultiplicity)
  super(childExpressionToRepeat)
  @multiplicity = aMultiplicity
end

Public Instance Methods

lazy!() click to toggle source

Apply the `lazy` flag.

Calls superclass method Regex::MonadicExpression#lazy!
# File lib/regex/repetition.rb, line 23
def lazy!
  multiplicity.policy = :lazy
  super
end

Protected Instance Methods

text_repr() click to toggle source

Conversion method re-definition. @return [String] String representation of the concatented expressions.

# File lib/regex/repetition.rb, line 32
def text_repr
  result = all_child_text + multiplicity.to_str
  return result
end