class C include Enumerable ... def each(&proc) @myarray.each do |e| proc.call(e) end end end
Nebo lépe
def each(&block) @myarray.each(&+block) end
S použitím modulu Forwardable
pak
require 'forwardable' class C extend Forwardable def_delegators(:@myarray, :each) end