2015-12-17から1日間の記事一覧
class CatList include Enumerable def initialize(*cats) @cats = cats end def each for v in @cats yield v end end end cats = CatList.new( "mike", "cha", "tora" ) p cats.map(&:upcase) # => ["MIKE", "CHA", "TORA"]
class CatList include Enumerable def initialize(*cats) @cats = cats end def each for v in @cats yield v end end end cats = CatList.new( "mike", "cha", "tora" ) p cats.map(&:upcase) # => ["MIKE", "CHA", "TORA"]