Background処理に関する最近の動向調査に関するメモ。

starling 面白そうだな。試してみよう。

posted by Png genki on Mon 3 Mar 2008 at 16:55

今回は、大げさな機能ではないですが、 知っているとちょっと便利なHelper関数を紹介します。

cycle

まずはcycle。これはCSSのクラスにeven, oddを指定する場合のような、 周期的に繰り返す文字列を簡単に埋め込むことが出来ます。

   1  @items = [1,2,3,4]
   2    <table>
   3    <% @items.each do |item| %>
   4      <tr class="<%= cycle("even", "odd") -%>">
   5        <td>item</td>
   6      </tr>
   7    <% end %>
   8    </table>

pluralize

英語のみですが、数詞の語尾変化を適切に行ってくれます。

   1  pluralize(1, 'person')          # => 1 person
   2  pluralize(2, 'person')          # => 2 people
   3  pluralize(3, 'person', 'users') # => 3 users
   4  pluralize(0, 'person')          # => 0 people

posted by Png genki on Mon 3 Mar 2008 at 15:29
Contents
Background処理に関するメモ
Railsの知っておくとちょっと便利なHelper関数
Comments
瀧内元気: MacOS版は以下にあります * [genki/ViMouse](https://githu... '23-1
dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これ... '13-1
瀧内元気: おお、チェックしてみます。thx! '11-12
overisland: Reeder for iPhone もこの UI を実装していますね。 '11-12
瀧内元気: その情報は見たのですが、以下のサイトによると、現在はまた必要になってるっぽいんですよね。 ... '11-12
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ