class TTFunk::OneBasedArray
Attributes
Public Class Methods
Source
# File lib/ttfunk/one_based_array.rb, line 7 def initialize(size = 0) @entries = Array.new(size) end
Public Instance Methods
Source
# File lib/ttfunk/one_based_array.rb, line 11 def [](idx) if idx.zero? raise IndexError, "index #{idx} was outside the bounds of the array" end entries[idx - 1] end
Source
# File lib/ttfunk/one_based_array.rb, line 28 def each(&block) entries.each(&block) end