script/console時にActiveRecordの結果を表形式で出力してくれる
便利ツール。
dotfiles整理中に、.irbrcに記載されているのを見つけたが
いつの間にか動かなくなっていた。
調べてみると、
Limitations
If using Wirble, you should call Hirb after it since they both override irb’s default output.
「Wirbleと併用する時は、Wirbleの後ろで呼んでね」と書いてある。
嵌ってしまった。。。
こんな感じ
Crawl.last SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 Crawl Load (0.4ms) SELECT * FROM `crawls` ORDER BY crawls.id DESC LIMIT 1 Crawl Columns (2.0ms) SHOW FIELDS FROM `crawls` +----+----------------------+----------------------+-----------------+--------+----------------+---------------+----------------------+-----------------------+ | id | start_at | end_at | processing_time | result | category_count | project_count | created_at | updated_at | +----+----------------------+----------------------+-----------------+--------+----------------+---------------+----------------------+-----------------------+ | 36 | 2010-09-15 02:33:... | 2010-09-15 02:36:... | 171.048 | true | 111 | 773 | 2010-09-15 02:33:... | 2010-09-15 02:36:2... | +----+----------------------+----------------------+-----------------+--------+----------------+---------------+----------------------+-----------------------+ 1 row in set
awesome_printってのもあるらしい
The Ruby Toolbox Search
※1位のdotfilesはrayanbのdotfilesが何故かカテゴライズされている模様。
2010/09/30追記
はてブで、下記コメントをもらっていましたので一応リプライ。
hirbは出力が横にはみ出て見えないので使わなくなったな
いつからかわかんないですが、項目数が多いと
MySQLの/Gみたいな感じで
vertical table形式で出力されるようになっています。
なかなか便利です。
また、項目の指定(config/hirb.yml)もできるようですが
いちいち面倒なので、しばらくはこれで使用してみようかと思います。
まぁ正直DBの中身見たい時は、SQL叩くんですが。
Project.last Project Load (47.6ms) SELECT * FROM `projects` ORDER BY projects.id DESC LIMIT 1 Project Columns (2.3ms) SHOW FIELDS FROM `projects` ** Error: Too many fields for the current width. Configure your width and/or fields to avoid this error. Defaulting to a vertical table. ** ************************ 1. row ************************ id: 26855 name: representative description: Builds XML representations of your Ruby objects project_link: http://github.com/mdub/representative score: 19 watcher_count: 19 fork_count: 0 last_commit: Wed, 11 Aug 2010 11:39:16 +0000 commit_link: http://github.com/mdub/representative/commits source_link: http://github.com/mdub/representative web_link: rdoc_link: http://rdoc.info/projects/mdub/representative wiki_link: gem_link: http://rubygems.org/gems/representative gem_name: representative gem_dl_count: 833 current_version: v0.2.4 current_dl_count: 29 crawl_id: 36 category_id: 3910 created_at: 2010-08-19 02:36:25 UTC updated_at: 2010-08-19 02:36:25 UTC 1 row in set