memo.log

技術情報の雑なメモ

2023-04-03から1日間の記事一覧

Enumerable とか Enumerator のメモ

Enumerableモジュールの場合 class Test include Enumerable end test = Test.new pp test.respond_to?(:map) # true pp test.respond_to?(:each) # false ####### class AlphabetCollection include Enumerable def initialize @elements = ["a", "b", "c"]…