Add bin and edit workflow
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s

This commit is contained in:
2026-09-16 13:11:16 -06:00
parent c8ac4fcae5
commit 4cee170d66
17576 changed files with 895740 additions and 2 deletions
@@ -0,0 +1,56 @@
# frozen_string_literal: true
module TTFunk
# Array with indexing starting at 1.
class OneBasedArray
include Enumerable
# @overload initialize(size)
# @param size [Integer] number of entries in this array
# @overload initialize(entries)
# @param entries [Array] an array to take entries from
def initialize(size = 0)
@entries = Array.new(size)
end
# Get element by index.
#
# @param idx [Integer]
# @return [any, nil]
# @raise IndexError if index is 0
def [](idx)
if idx.zero?
raise IndexError,
"index #{idx} was outside the bounds of the array"
end
entries[idx - 1]
end
# Number of elements in this array.
#
# @return [Integer]
def size
entries.size
end
# Convert to native array.
#
# @return [Array]
def to_ary
entries
end
# Iterate over elements.
#
# @yieldparam element [any]
# @return [void]
def each(&block)
entries.each(&block)
end
private
attr_reader :entries
end
end