Sha256: 8f46536cfaa1cfa2a4a0796590e99bad17e0fe2f5c9ffa0be123793aa13c5c84
Contents?: true
Size: 510 Bytes
Versions: 4
Compression:
Stored size: 510 Bytes
Contents
# frozen_string_literal: true module TTFunk class OneBasedArray include Enumerable def initialize(size = 0) @entries = Array.new(size) end def [](idx) if idx == 0 raise IndexError, "index #{idx} was outside the bounds of the array" end entries[idx - 1] end def size entries.size end def to_ary entries end def each(&block) entries.each(&block) end private attr_reader :entries end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ttfunk-1.6.2.1 | lib/ttfunk/one_based_array.rb |
ttfunk-1.6.2 | lib/ttfunk/one_based_array.rb |
ttfunk-1.6.1 | lib/ttfunk/one_based_array.rb |
ttfunk-1.6.0 | lib/ttfunk/one_based_array.rb |