Rubyにはirb(1)と呼ばれるツールが付属している。irb(interactive ruby)は、Rubyの対話的なシェルで、標準入力からRubyのコードを入力して実行できる。exit、quit、jobs、fg、killなどインタラクティブシェルとして動作するための拡張コマンドが用意されているほか、プロンプトの設定機能や履歴機能なども搭載されている。 図1のようにirb(1)コマンドを実行すればインタラクティブシェルが起動するのでそのまま操作すればよい。 図.1 irb(1)操作例 – sh(1)やcsh(1)などの基本的な機能を備えたシェルによく似ている irb(1)には拡張セットとしてWirbleというパッケージが用意されているのだが、同パッケージを使うとインタラクティブシェルに色がつくようになるほか、補完入力が効くようになるなど便利だ。小技として知っておいて損はないので、紹介して
はてなグループの終了日を2020年1月31日(金)に決定しました 以下のエントリの通り、今年末を目処にはてなグループを終了予定である旨をお知らせしておりました。 2019年末を目処に、はてなグループの提供を終了する予定です - はてなグループ日記 このたび、正式に終了日を決定いたしましたので、以下の通りご確認ください。 終了日: 2020年1月31日(金) エクスポート希望申請期限:2020年1月31日(金) 終了日以降は、はてなグループの閲覧および投稿は行えません。日記のエクスポートが必要な方は以下の記事にしたがって手続きをしてください。 はてなグループに投稿された日記データのエクスポートについて - はてなグループ日記 ご利用のみなさまにはご迷惑をおかけいたしますが、どうぞよろしくお願いいたします。 2020-06-25 追記 はてなグループ日記のエクスポートデータは2020年2月28
なんか動いたみたいだけどこんな簡単でいいのかな。 irb/ole.rb require 'win32ole' require 'irb/completion' class WIN32OLE alias :orig_methods :methods def methods(flag = true) @ole_methods ||= ole_methods.map { |m| m.to_s.downcase } @ole_methods | orig_methods(flag) end end動作例: D:\jitte\Ruby> irb -r irb/ole irb(main):001:0> app = WIN32OLE.new('Excel.Application') => #<WIN32OLE:0x29b88e8> irb(main):002:0> app.work[TAB][TAB]
http://www.rubygarden.org/ruby?Irb/TipsAndTricks より。以前から irb は使い勝手が悪いと感じていたけど、タブ補完も ri もちゃんとできるのね。 ~/.irbrc #/usr/bin/env ruby # ri を使えるようにする def do_ri(arg) pager = (ENV["PAGER"] or "less") cmd = ("refe #{arg} | nkf -w | #{pager}") puts cmd system(cmd) end class Object def ri(word=nil) if word do_ri(word) else do_ri(self.class.to_s) end end end class Module def ri(meth=nil) if meth if instance_met
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く