Phi::Enumerable
$(Apollo)/bin/phi.rb
Delphi のクラスでは、Ruby の Enumerable 相当の機能が count と [] に分かれている。そのタイプの Delphi クラスを Ruby の Enumerable にしてしまうためのモジュール。
module Phi module Enumerable include ::Enumerable def each (0...self.count).each{|i| yield self[i]} end end end
* 他に、items.count と items[] で実現しているタイプもあるので、そのタイプについては Phi::ItemsEnumerable を用意している。
Keyword(s):
References:[Phi-Constants] [Phi::ItemsEnumerable]