LoginSignup
1
0

More than 5 years have passed since last update.

「 "15Fizz".to_i # => 15 」なんですね。知らなかった。「 "FizzBuzz".to_i # => 0 」や「 "0.1Buzz".to_i # => 0 」も使って項番がない行を削除してみた。

Last updated at Posted at 2012-03-16
# coding: UTF-8

puts DATA.lines.map{ |line| line * ( line.to_i <=> 0 )}.grep(/\w+/){ |e| e.strip }

__END__
    1 Ruby哲学
    2 実装
        公式な実装
        その他の実装
    3 競合言語
    4 例
        コレクション
        制御構造
        ブロック付きメソッド呼び出し
            繰り返し処理
            後処理の省力化
            本処理を後から指定
            クロージャ
        クラス
        例外処理
    5 Rubyの周辺技術
    6 Rubyで開発されたアプリケーション
    7 Rubyを組み込んだアプリケーション
    8 エピソード
    9 参考文献
    10 関連項目
    11 脚注
        00.1 注釈
        00.2 出典
    12 外部リンク

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0