Class: Rrrex::NumberMatch
- Includes:
- SingleAtomMatch
- Defined in:
- lib/rrrex/number_match.rb
Instance Attribute Summary
Attributes included from SingleAtomMatch
Instance Method Summary collapse
-
#initialize(a, min, max) ⇒ NumberMatch
constructor
A new instance of NumberMatch.
- #to_regexp_string ⇒ Object
Methods included from SingleAtomMatch
Methods inherited from Match
#+, convert, #group_names, #match, #not, #or, #wrap
Constructor Details
#initialize(a, min, max) ⇒ NumberMatch
Returns a new instance of NumberMatch.
6 7 8 9 10 |
# File 'lib/rrrex/number_match.rb', line 6 def initialize( a, min, max ) super a @min = min @max = max end |
Instance Method Details
#to_regexp_string ⇒ Object
12 13 14 15 |
# File 'lib/rrrex/number_match.rb', line 12 def to_regexp_string # Subtle: when nil, we want min to convert to 0, but max to convert to "" wrap atom.to_regexp_string + "{#{@min.to_i},#{@max}}" end |