class Regex::Alternation

Abstract class. A n-ary matching operator. It succeeds when one child expression succeeds to match the subject text

Public Class Methods

new(*theChildren) click to toggle source

Constructor.

Calls superclass method
# File lib/regex/alternation.rb, line 12
def initialize(*theChildren)
  super(theChildren)
end

Protected Instance Methods

text_repr() click to toggle source

Conversion method re-definition. Purpose: Return the String representation of the concatented expressions.

# File lib/regex/alternation.rb, line 20
def text_repr
  result_children = children.map(&:to_str)
  "(?:#{result_children.join('|')})"
end