ReFe

2005-12-15 05:26:33 +0900 (932d); rev 3

URL: http://i.loveruby.net/ja/projects/refe/

Ruby の日本語リファレンスマニュアルを コマンドラインから検索し表示するツール。

実行例

引数なしで実行するとドキュメントの存在するクラスの一覧を表示

% refe | head
ARGF ArgumentError Array BasicSocket Bignum Binding CGI
CGI::Cookie CGI::Session Class Comparable Complex
ConditionVariable Config Continuation Curses::Window DBM DL
DL::Importable DL::Importable::Memory
DL::Importable::Struct DL::Importable::Union DL::Types Data
Date Delegator Digest Dir ENV EOFError ERB ERB::DefMethod
ERB::Util Enumerable Errno Errno::EXXX Etc Exception
Exception2MessageMapper Exceptions FalseClass Fcntl File
File::Constants File::Stat FileTest FileUtils
FileUtils::NoWrite FileUtils::Verbose Finalizer Find Fixnum

クラス名を指定するとそのクラスのメソッド一覧を表示

~ % refe Array
==== Array ====
配列クラス。配列の要素は任意の Ruby オブジェクトです。
一般的には配列は配列式を使って

  [1, 2, 3]

のように生成します。
---- Singleton methods ----
[] new
---- Instance methods ----
& * + - << <=> == [] []= assoc at clear clone collect!
compact compact! concat delete delete_at delete_if dup each
each_index empty? eql? fetch fill first flatten flatten!
include? index indexes indices insert join last length map!
nitems pack pop push rassoc reject! replace reverse
reverse! reverse_each rindex shift size slice slice! sort
sort! to_a to_ary to_s transpose uniq uniq! unshift
values_at |
---- Singleton methods (inherited) ----
---- Instance methods (inherited) ----
=== =~ __id__ __send__ _dump _load all? any? class collect
detect display each_with_index entries equal? extend find
find_all freeze frozen? grep hash id initialize
initialize_copy inject inspect instance_eval instance_of?
instance_variable_get instance_variable_set
instance_variables is_a? kind_of? map marshal_dump
marshal_load max member? method method_missing methods min
nil? object_id partition pretty_print pretty_print_cycle
pretty_print_instance_variables private_methods
protected_methods public_methods reject
remove_instance_variable respond_to? select send
singleton_method_added singleton_method_removed
singleton_method_undefined singleton_methods sort_by taint
tainted? to_hash to_int to_str type untaint zip

クラス名とメソッド名を指定するとドキュメントを表示

% refe String concat
String#concat
--- self << other
--- concat(other)

    文字列 other の内容を self に連結します。
    other が 0 から 255 の範囲の Fixnum である場合は
    その 1 バイトを末尾に追加します。

    self を返します。

メソッド名は適当に補完してくれる

% refe str con
String#concat
--- self << other
--- concat(other)

    文字列 other の内容を self に連結します。
    other が 0 から 255 の範囲の Fixnum である場合は
    その 1 バイトを末尾に追加します。

    self を返します。

「-c」オプションで対応する C の関数を表示

% refe str con -c
String#concat
string.c:712
VALUE
rb_str_concat(str1, str2)
    VALUE str1, str2;
{
    if (FIXNUM_P(str2)) {
        int i = FIX2INT(str2);
        if (0 <= i && i <= 0xff) { /* byte */
            char c = i;
            return rb_str_cat(str1, &c, 1);
        }
    }
    str1 = rb_str_append(str1, str2);

    return str1;
}

system revision 1.162