- 2007-12-27 (木)
- 技術
Rubyist Magazine - Ruby の歩き方より。
ri というコマンドを使うとコマンドラインからリファレンスマニュアルを検索・表示できます。 対象のリファレンスマニュアルが英語なのが難点ですが、 Ruby 1.8 と一緒にインストールされるところが利点です。
via: Rubyist Magazine - Ruby の歩き方
う~ん、やっとRubyのHelpの見方が分かったんだけど英語ね。
こうゆうときに自分が英語ができないのにすこぶる腹が立つわいな。
でもとりあえずHelp使ってみる。以下はStringクラスのchopメソッドの説明を見た場合
C:\>ri String.chop(違う書き方で ri String#chopでもいいらしい)
んで以下がその説明
------------------------------------------------------------ String#chop
str.chop => new_str
------------------------------------------------------------------------
Returns a new +String+ with the last character removed. If the
string ends with +\r\n+, both characters are removed. Applying
+chop+ to an empty string returns an empty string. +String#chomp+
is often a safer alternative, as it leaves the string unchanged if
it doesn't end in a record separator.
"string\r\n".chop #=> "string"
"string\n\r".chop #=> "string\n"
"string\n".chop #=> "string"
"string".chop #=> "strin"
"x".chop.chop #=> ""
おっ、意外と読めるかも。
「Returns a new +String+ with the last character removed」
この部分で大体さっしは付いたけど、でも間違えて覚えてしまいそうで怖い・・・w
日本語で手軽に見れるヘルプを探そうっと!
- Newer: Rubyの日本語リファレンスマニュアルで快適Ruby生活を送ろう
- Older: ワーキングプア体験日記が感慨深かったお
Comments:0
Trackback:0
- TrackBack URL for this entry
- http://hisasann.com/cgi-bin/mt/mt-tb.cgi/756
- Listed below are links to weblogs that reference
- RubyでコマンドラインからHelpを見る「ri」コマンドを試してみた from HouseTect, JavaScript Blog


