class MemDB::Idx::Chars::Chars

Attributes

length[R]

Public Class Methods

new(str) click to toggle source
# File lib/mem_db/idx/chars.rb, line 15
def initialize(str)
  @str = str
  @length = str.length
end

Public Instance Methods

[](pos) click to toggle source
# File lib/mem_db/idx/chars.rb, line 20
def [](pos)
  @str[pos]
end
each() { |str| ... } click to toggle source
# File lib/mem_db/idx/chars.rb, line 30
def each
  return to_enum unless block_given?

  i = 0
  while i < @length
    yield @str[i]
    i += 1
  end
end
reverse() click to toggle source
# File lib/mem_db/idx/chars.rb, line 26
def reverse
  ReversedChars.new(@str)
end