Class: Spectre::StringParsing::DigitParser

Inherits:
RangeParser
  • Object
show all
Defined in:
lib/spectre/string/primitives.rb

Overview

Matches numeric digits. Shortcut: digit.

Instance Attribute Summary

Attributes included from Parser

#node

Instance Method Summary collapse

Methods inherited from RangeParser

#negation, #scan

Methods included from Parser

#backtrack, #create_match, from_POD, #pre_skip?, #scan, #to_p

Constructor Details

#initializeDigitParser

Returns a new instance of DigitParser.



196
197
198
# File 'lib/spectre/string/primitives.rb', line 196

def initialize
    super( ('0'..'9').to_a )
end

Instance Method Details

#inspectObject



200
201
202
# File 'lib/spectre/string/primitives.rb', line 200

def inspect
    "[digit]"
end