Class: Spectre::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/spectre/base/parser.rb

Overview

Keeps the match a Parser made.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(length = 0, value = nil) ⇒ Match

Initializes a new Match object with the length of the consumed input and the value returned by the parsing process.



38
39
40
# File 'lib/spectre/base/parser.rb', line 38

def initialize length = 0, value = nil
    @length, @value = length, value
end

Instance Attribute Details

#lengthObject

The size of the consumed input - Integer.



28
29
30
# File 'lib/spectre/base/parser.rb', line 28

def length
  @length
end

#valueObject

The value extracted by the parsing process.



32
33
34
# File 'lib/spectre/base/parser.rb', line 32

def value
  @value
end