class RKelly::CharRange
Represents a syntax element location in source code - where it begins and where it ends.
It’s a value object - it can’t be modified.
Constants
- EMPTY
A re-usable empty range
Attributes
from[R]
to[R]
Public Class Methods
new(from, to)
click to toggle source
# File lib/rkelly/char_range.rb, line 11 def initialize(from, to) @from = from @to = to end
Public Instance Methods
next(string)
click to toggle source
Creates a new range that immediately follows this one and contains the given string.
# File lib/rkelly/char_range.rb, line 18 def next(string) CharRange.new(@to.next(string.slice(0, 1)), @to.next(string)) end
to_s()
click to toggle source
# File lib/rkelly/char_range.rb, line 22 def to_s "<#{@from}...#{@to}>" end
Also aliased as: inspect