Class: Regex::Expression

Inherits:
Object
  • Object
show all
Defined in:
lib/regex/expression.rb

Overview

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

Direct Known Subclasses

AtomicExpression, CompoundExpression

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeExpression

Constructor



12
# File 'lib/regex/expression.rb', line 12

def initialize(); end

Instance Attribute Details

#begin_anchorObject

Returns the value of attribute begin_anchor.



8
9
10
# File 'lib/regex/expression.rb', line 8

def begin_anchor
  @begin_anchor
end

#end_anchorObject

Returns the value of attribute end_anchor.



9
10
11
# File 'lib/regex/expression.rb', line 9

def end_anchor
  @end_anchor
end

Instance Method Details

#atomic?Boolean

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

Returns:

  • (Boolean)


17
18
19
# File 'lib/regex/expression.rb', line 17

def atomic?
  abstract_method
end

#options(theParentOptions) ⇒ Object

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. by options with same name that are bound to this object.

Parameters:

  • theParentOptions (Hash)

    matching options. They are overridden



26
27
28
29
# File 'lib/regex/expression.rb', line 26

def options(theParentOptions)
  resulting_options = theParentOptions.merge(@local_options)
  return resulting_options
end

#to_strString

Template method.

Returns:

  • (String)

    text representation of the expression.



33
34
35
36
37
38
39
40
# File 'lib/regex/expression.rb', line 33

def to_str
  result = ''
  result << prefix
  result << text_repr
  result << suffix

  return result
end