Class: Regex::CharRange
- Inherits:
-
PolyadicExpression
- Object
- Expression
- CompoundExpression
- PolyadicExpression
- Regex::CharRange
- Defined in:
- lib/regex/char_range.rb
Overview
A binary expression that represents a contiguous range of characters. Assumption: characters are ordered by codepoint
Instance Attribute Summary
Attributes inherited from PolyadicExpression
Attributes inherited from Expression
Instance Method Summary collapse
-
#initialize(theLowerBound, theUpperBound) ⇒ CharRange
constructor
Constructor.
-
#lower ⇒ Object
Return the lower bound of the range.
-
#upper ⇒ Object
Return the upper bound of the range.
Methods inherited from PolyadicExpression
#<<, #df_visitor, #done!, #lazy!
Methods inherited from CompoundExpression
Methods inherited from Expression
Constructor Details
#initialize(theLowerBound, theUpperBound) ⇒ CharRange
Constructor. [thelowerBound] A character that will be the lower bound value for the range. [theUpperBound] A character that will be the upper bound value for the range. TODO: optimisation. Build a Character if lower bound == upper bound.
15 16 17 18 |
# File 'lib/regex/char_range.rb', line 15 def initialize(theLowerBound, theUpperBound) range = validated_range(theLowerBound, theUpperBound) super(range) end |
Instance Method Details
#lower ⇒ Object
Return the lower bound of the range.
21 22 23 |
# File 'lib/regex/char_range.rb', line 21 def lower children.first end |
#upper ⇒ Object
Return the upper bound of the range.
26 27 28 |
# File 'lib/regex/char_range.rb', line 26 def upper children.last end |