Class: Tcepsni::Vendor::StringScanner
- Inherits:
-
Object
- Object
- Tcepsni::Vendor::StringScanner
- Defined in:
- lib/tcepsni/vendor/string_scanner.rb
Instance Attribute Summary collapse
-
#pos ⇒ Object
readonly
Returns the value of attribute pos.
-
#rest ⇒ Object
readonly
Returns the value of attribute rest.
-
#scanned ⇒ Object
readonly
Returns the value of attribute scanned.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(pos:, total:, scanned:, rest:) ⇒ StringScanner
constructor
A new instance of StringScanner.
Constructor Details
#initialize(pos:, total:, scanned:, rest:) ⇒ StringScanner
Returns a new instance of StringScanner.
6 7 8 9 10 11 |
# File 'lib/tcepsni/vendor/string_scanner.rb', line 6 def initialize(pos:, total:, scanned:, rest:) @pos = pos @total = total @scanned = scanned @rest = rest end |
Instance Attribute Details
#pos ⇒ Object (readonly)
Returns the value of attribute pos.
4 5 6 |
# File 'lib/tcepsni/vendor/string_scanner.rb', line 4 def pos @pos end |
#rest ⇒ Object (readonly)
Returns the value of attribute rest.
4 5 6 |
# File 'lib/tcepsni/vendor/string_scanner.rb', line 4 def rest @rest end |
#scanned ⇒ Object (readonly)
Returns the value of attribute scanned.
4 5 6 |
# File 'lib/tcepsni/vendor/string_scanner.rb', line 4 def scanned @scanned end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
4 5 6 |
# File 'lib/tcepsni/vendor/string_scanner.rb', line 4 def total @total end |
Class Method Details
.dependencies ⇒ Object
31 32 33 |
# File 'lib/tcepsni/vendor/string_scanner.rb', line 31 def self.dependencies [] end |
.object? ⇒ Boolean
35 36 37 |
# File 'lib/tcepsni/vendor/string_scanner.rb', line 35 def self.object? true end |
.parse(parser) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tcepsni/vendor/string_scanner.rb', line 13 def self.parse(parser) pos = parser.pos parser.skip('StringScanner ') and pos = parser.parse_integer and parser.skip('/') and total = parser.parse_integer and parser.skip(' ') and scanned = parser.parse_string and parser.skip(' @ ') and rest = parser.parse_string and parser.skip('>') and Tcepsni::Vendor::StringScanner.new(pos:, total:, scanned:, rest:) or begin parser.pos = pos nil end end |