タグ

ブックマーク / niku.name (1)

  • ヽ(´・肉・`)ノログ(2010-10-23)

    _ [ruby][planet] クラスベースの Pragger のようなものが作りたい Ruby だと | をメソッドとして定義できるんですね.それを利用して Foo | WithIndex | Reverse と書くとよしなにしてくれるスクリプトをrubyで書く方法を考えました.まだ block 取れないんですけど Foo | WithIndex | Reverse | Grep { |e| e[1] == 1} と書くと結果が ["foo", 1] になるように今後改造してみたいです. module Praggerable attr_accessor :this def | other other.new self.this end def self.included mod mod.extend ClassMethods end module ClassMethods def |

  • 1