class Parslet::Position
Encapsules the concept of a position inside a string.
Attributes
bytepos[R]
Public Class Methods
new(string, bytepos)
click to toggle source
# File lib/parslet/position.rb, line 9 def initialize string, bytepos @string = string @bytepos = bytepos end
Public Instance Methods
<=>(b)
click to toggle source
# File lib/parslet/position.rb, line 18 def <=> b self.bytepos <=> b.bytepos end
charpos()
click to toggle source
# File lib/parslet/position.rb, line 14 def charpos @string.byteslice(0, @bytepos).size end