first commit
CI / Build (clang, clang++, ubuntu-22.04, linux, 3.10, master, x86,x86_64) (push) Canceled after 0s
CI / Build (clang, clang++, windows-2022, windows, 3.10, master, x86,x86_64) (push) Canceled after 0s
CI / Release (push) Canceled after 0s

This commit is contained in:
2026-09-13 22:18:11 +01:00
commit 08c03ac533
6701 changed files with 1577314 additions and 0 deletions
@@ -0,0 +1,62 @@
##
# chain.rb Enumerator::Chain class
# See Copyright Notice in mruby.h
module Enumerable
def chain(*args)
Enumerator::Chain.new(self, *args)
end
end
class Enumerator
def +(other)
Chain.new(self, other)
end
class Chain
include Enumerable
def initialize(*args)
@enums = args.freeze
@pos = -1
end
def each(&block)
return to_enum unless block
i = 0
while i < @enums.size
@pos = i
@enums[i].each(&block)
i += 1
end
self
end
def size
@enums.reduce(0) do |a, e|
return nil unless e.respond_to?(:size)
a + e.size
end
end
def rewind
while 0 <= @pos && @pos < @enums.size
e = @enums[@pos]
e.rewind if e.respond_to?(:rewind)
@pos -= 1
end
self
end
def +(other)
self.class.new(self, other)
end
def inspect
"#<#{self.class}: #{@enums.inspect}>"
end
end
end