class LazyString::LazySubString
Attributes
length[R]
size[R]
Public Class Methods
new(value, start, size)
click to toggle source
# File lib/lazy-string.rb, line 12 def initialize(value, start, size) @start = start @size = size @value = value end
Public Instance Methods
[](*args)
click to toggle source
# File lib/lazy-string.rb, line 18 def [](*args) if args.size == 2 start = args[0] length = args[1] return @value[@start + start, length] else raise NotImplementedError end end
to_str()
click to toggle source
# File lib/lazy-string.rb, line 28 def to_str @value[@start, @size].to_str end
Also aliased as: to_s