class Regex::Expression

Abstract class. The generalization of any valid regular (sub)expression.

Attributes

begin_anchor[RW]

@return [NilClass, Anchor]

end_anchor[RW]

@return [NilClass, Anchor]

Public Class Methods

new() click to toggle source

Constructor

# File lib/regex/expression.rb, line 17
def initialize(); end

Public Instance Methods

atomic?() click to toggle source

Abstract method. Return true iff the expression is atomic (= doesn't not have any child). @return [Boolean]

# File lib/regex/expression.rb, line 22
def atomic?
  abstract_method
end
options(theParentOptions) click to toggle source

Determine the matching options to apply to this object, given the options coming from the parent and options that are local to this object. Local options take precedence. @param theParentOptions [Hash] matching options. They are overridden by options with same name that are bound to this object.

# File lib/regex/expression.rb, line 31
def options(theParentOptions)
  resulting_options = theParentOptions.merge(@local_options)
  return resulting_options
end
to_str() click to toggle source

Template method. @return [String] text representation of the expression.

# File lib/regex/expression.rb, line 38
def to_str
  result = +''
  result << prefix
  result << text_repr
  result << suffix

  return result
end

Protected Instance Methods

prefix() click to toggle source
# File lib/regex/expression.rb, line 49
def prefix
  begin_anchor ? begin_anchor.to_str : ''
end
suffix() click to toggle source
# File lib/regex/expression.rb, line 53
def suffix
  end_anchor ? end_anchor.to_str : ''
end