サクサク読めて、アプリ限定の機能も多数!
Clazz < Struct.new(:attribute); def method() ... end; end ではなく Clazz = Struct.new(:attribute) do; def method() ... end; end な感じがいいという話
kiyo_hiko のブックマーク 2016/01/28 16:41
Structクラスを継承してはいけない(戒め - Bye Bye Moore[ruby][style][def][class]Clazz < Struct.new(:attribute); def method() ... end; end ではなく Clazz = Struct.new(:attribute) do; def method() ... end; end な感じがいいという話2016/01/28 16:41
Clazz < Struct.new(:attribute); def method() ... end; end ではなく Clazz = Struct.new(:attribute) do; def method() ... end; end な感じがいいという話
このブックマークにはスターがありません。 最初のスターをつけてみよう!
shuzo-kino.hateblo.jp2016/01/28
以前書いたStructで構造体なデータを扱う - Bye Bye Mooreという記事で class Point < Struct.new(:x, :y) def +(other_object) Point.new(x + other_object.x, y + other_object.y) end end とか書いていました...
3 人がブックマーク・1 件のコメント
\ コメントが サクサク読める アプリです /
Clazz < Struct.new(:attribute); def method() ... end; end ではなく Clazz = Struct.new(:attribute) do; def method() ... end; end な感じがいいという話
このブックマークにはスターがありません。
最初のスターをつけてみよう!
Structクラスを継承してはいけない(戒め - Bye Bye Moore
以前書いたStructで構造体なデータを扱う - Bye Bye Mooreという記事で class Point < Struct.new(:x, :y) def +(other_object) Point.new(x + other_object.x, y + other_object.y) end end とか書いていました...
3 人がブックマーク・1 件のコメント
\ コメントが サクサク読める アプリです /