class Regex::Anchor
An anchor is a zero-width assertion based on the current position.
Constants
- AnchorToSymbol
A Hash for converting a lexeme to a symbolic value
Attributes
kind[R]
A symbolic value that identifies the type of assertion to perform
Public Class Methods
new(aKind)
click to toggle source
Constructor @param aKind [String] Lexeme representation of the anchor
Calls superclass method
# File lib/regex/anchor.rb, line 28 def initialize(aKind) super() @kind = valid_kind(aKind) end
Public Instance Methods
to_str()
click to toggle source
Conversion method re-definition. Purpose: Return the String representation of the expression.
# File lib/regex/anchor.rb, line 35 def to_str AnchorToSymbol.rassoc(kind).first end
Private Instance Methods
valid_kind(aKind)
click to toggle source
Return the symbolic value corresponding to the given lexeme.
# File lib/regex/anchor.rb, line 42 def valid_kind(aKind) AnchorToSymbol[aKind] end