Module: BitClust::Irb
- Defined in:
- lib/bitclust/irb.rb
Constant Summary collapse
- USAGE =
<<~USAGE Usage: refe <pattern> 例: refe String#gsub インスタンスメソッド refe Array.new 特異メソッド refe Comparable クラス・モジュール refe printf 名前だけでの検索 DB が無い場合は `bitclust setup` で作成してください。 USAGE
Class Method Summary collapse
-
.lookup(pattern, io: $stdout, db: nil) ⇒ Object
pattern を検索して整形済みテキストを io へ書く。db が nil なら 既定の場所から探す。検索の失敗は例外にせず io へメッセージを書く (irb セッションを止めないため).
Class Method Details
.lookup(pattern, io: $stdout, db: nil) ⇒ Object
pattern を検索して整形済みテキストを io へ書く。db が nil なら 既定の場所から探す。検索の失敗は例外にせず io へメッセージを書く (irb セッションを止めないため)
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bitclust/irb.rb', line 29 def self.lookup(pattern, io: $stdout, db: nil) words = pattern.to_s.split if words.empty? io.puts USAGE return end view = TerminalView.new(Plain.new, { describe_all: false, line: false, encoding: nil }, io: io) Searcher.new.run_query(db, words, view) rescue BitClust::UserError => err io.puts err. end |