LoginSignup
6
6

More than 5 years have passed since last update.

CUIコマンドライン上でRubyドキュメントで検索を行うことができるGemを作成(るりまサーチ利用)

Last updated at Posted at 2014-10-05

インストール

$ gem install ruremasearcher 

使用方法

$ ruremasercher search <検索したい文字列>
(検索文字列が複数の場合はクォーテーションで囲ってください)
最大5件まで検索結果が表示されます。
例:
$ ruremasercher search "http post"

検索を行う

$ ruremasearcher search "each with index"
---検索結果:1件目------------------------------
タイトル: Prime::PseudoPrimeGenerator#each_with_index {|prime, index| ... } -> self
分類:インスタンスメソッド
要約:与えられたブロックに対して、素数を0起点の連番を渡して評価します。
説明:...れた場合は self を返します。 ブロックを与えられなかった場合は Enumerator を返します。例:  Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|    p [prime, index]  end  # [2, 0]  # [3, 1]  # [5, 2]  # [7, 3]@see Enumerator#with_index...
---検索結果:2件目------------------------------
タイトル: Enumerable#each_with_index {|item, index| ... } -> self
分類:インスタンスメソッド
要約:要素とそのインデックスをブロックに渡して繰り返します。
説明:...す。self を返します。ブロックを省略した場合は、要素とそのインデックスを繰り返すようなEnumerator を返します。例:    [5, 10, 15].each_with_index do |n, idx|      p [n, idx]    end        # => [5, 0]        #    [10, 1]        #    [15, 2]...
---検索結果:3件目------------------------------
タイトル: Prime::PseudoPrimeGenerator#each_with_index -> Enumerator
分類:インスタンスメソッド
要約:与えられたブロックに対して、素数を0起点の連番を渡して評価します。
説明:...れた場合は self を返します。 ブロックを与えられなかった場合は Enumerator を返します。例:  Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|    p [prime, index]  end  # [2, 0]  # [3, 1]  # [5, 2]  # [7, 3]@see Enumerator#with_index...
---検索結果:4件目------------------------------
タイトル: Matrix#each_with_index(which = :all) -> Enumerator
分類:インスタンスメソッド
要約:行列の各要素をその位置とともに引数としてブロックを呼び出します。
説明:...要素の範囲を指定することができます。Matrix#each と同じなのでそちらを参照してください。ブロックを省略した場合、 Enumerator を返します。  Matrix[ [1,2], [3,4] ].each_with_index do |e, row, col|    puts "#{e} at #{row}, #{col}"  end    # =>...                          ...1 at 0, 0    # => 2 at 0, 1    # => 3 at 1, 0    # => 4 at 1, 1@param which どの要素に対してブロックを呼び出すのかを Symbol で指定します@see Matrix#each...
---検索結果:5件目------------------------------
タイトル: Matrix#each_with_index(which = :all) {|e, row, col| ... } -> self
分類:インスタンスメソッド
要約:行列の各要素をその位置とともに引数としてブロックを呼び出します。
説明:...要素の範囲を指定することができます。Matrix#each と同じなのでそちらを参照してください。ブロックを省略した場合、 Enumerator を返します。  Matrix[ [1,2], [3,4] ].each_with_index do |e, row, col|    puts "#{e} at #{row}, #{col}"  end    # =>...                          ...1 at 0, 0    # => 2 at 0, 1    # => 3 at 1, 0    # => 4 at 1, 1@param which どの要素に対してブロックを呼び出すのかを Symbol で指定します@see Matrix#each...

リンク

■ るりまサーチ: http://docs.ruby-lang.org/ja/search/

■ Gem「RuremaSearcher」:

6
6
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
6
6