るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.008秒)
トップページ > クエリ:**[x] > ライブラリ:readline[x]

別のキーワード

  1. _builtin **
  2. matrix **
  3. bigdecimal **
  4. rational **
  5. bn **

オブジェクト

検索結果

Readline::HISTORY.[](index) -> String (14.0)

ヒストリから index で指定したインデックスの内容を取得します。 例えば index に 0 を指定すると最初の入力内容が取得できます。 また、 -1 は最後の入力内容というように、index に負の値を指定することで、 最後から入力内容を取得することもできます。

...も大きな値の場合に発生します。

例:

require "readline"

Readline
::HISTORY[0] #=> 最初の入力内容
Readline
::HISTORY[4] #=> 5番目の入力内容
Readline
::HISTORY[-1] #=> 最後の入力内容
Readline
::HISTORY[-5] #=> 最後から5番目の入力内容

例: 1000000...
...IndexError が発生します。

require "readline"

Readline
::HISTORY[1000000] #=> 例外 IndexError が発生します。

例: 32 bit のシステムの場合、例外 RangeError が発生します。

require "readline"

Readline
::HISTORY[2 ** 32 + 1] #=> 例外 RangeError が発生し...
...ます。

例: 64 bit のシステムの場合、例外 RangeError が発生します。

require "readline"

Readline
::HISTORY[2 ** 64 + 1] #=> 例外 RangeError が発生します。...