メソッドチェーン
ぜんぜんわかってないけど
$book->author( 'a' ) $book->name( 'b' ) $book->to_string;
くらいだと、以下のようになると見易いとおもう。というかnewの引数?
$book->set_attributes( author => 'a', name => 'b', ); $book->to_string;
セッターはまとめて指定できて、ゲッターは個別に取得がわかりやすい。
ぜんぜんわかってないけど
$book->author( 'a' ) $book->name( 'b' ) $book->to_string;
くらいだと、以下のようになると見易いとおもう。というかnewの引数?
$book->set_attributes( author => 'a', name => 'b', ); $book->to_string;
セッターはまとめて指定できて、ゲッターは個別に取得がわかりやすい。