るりまサーチ

最速Rubyリファレンスマニュアル検索!
653件ヒット [1-100件を表示] (0.040秒)

別のキーワード

  1. bigdecimal mode
  2. openssl fips_mode=
  3. bigdecimal round_mode
  4. readline vi_editing_mode
  5. readline emacs_editing_mode

ライブラリ

クラス

モジュール

検索結果

<< 1 2 3 ... > >>

IO.read(path, **opt) -> String | nil (18145.0)

path で指定されたファイルを offset 位置から length バイト分読み込んで返します。

...合は nil を返します。ただし、length に nil か 0 が指定されている場合は、空文字列 "" を返します。例えば、IO.read(空ファイル) は "" を返します。

引数 length が指定された場合はバイナリ読み込みメソッド、そうでない場合は...
...込んだ文字列のエンコーディングを指定します。
読み込む長さを指定した場合はこれは無視されます。

: :mode

IO.open のモードを指定します。
"r" で始まる文字列である必要があります。

: :open_args

IO.open に渡され...
...ng など
IO.open のオプション引数が指定できます。

@see IO.binread

例:

IO.read(empty_file) #=> ""
IO.read(empty_file, 1) #=> nil
IO.read(one_byte_file, 0, 10) #=> ""
IO.read(one_byte_file, nil, 10) #=> ""
IO.read(one_byte_file, 1, 10) #=> nil...

IO.read(path, length = nil, **opt) -> String | nil (18145.0)

path で指定されたファイルを offset 位置から length バイト分読み込んで返します。

...合は nil を返します。ただし、length に nil か 0 が指定されている場合は、空文字列 "" を返します。例えば、IO.read(空ファイル) は "" を返します。

引数 length が指定された場合はバイナリ読み込みメソッド、そうでない場合は...
...込んだ文字列のエンコーディングを指定します。
読み込む長さを指定した場合はこれは無視されます。

: :mode

IO.open のモードを指定します。
"r" で始まる文字列である必要があります。

: :open_args

IO.open に渡され...
...ng など
IO.open のオプション引数が指定できます。

@see IO.binread

例:

IO.read(empty_file) #=> ""
IO.read(empty_file, 1) #=> nil
IO.read(one_byte_file, 0, 10) #=> ""
IO.read(one_byte_file, nil, 10) #=> ""
IO.read(one_byte_file, 1, 10) #=> nil...

IO.read(path, length = nil, offset = 0, **opt) -> String | nil (18145.0)

path で指定されたファイルを offset 位置から length バイト分読み込んで返します。

...合は nil を返します。ただし、length に nil か 0 が指定されている場合は、空文字列 "" を返します。例えば、IO.read(空ファイル) は "" を返します。

引数 length が指定された場合はバイナリ読み込みメソッド、そうでない場合は...
...込んだ文字列のエンコーディングを指定します。
読み込む長さを指定した場合はこれは無視されます。

: :mode

IO.open のモードを指定します。
"r" で始まる文字列である必要があります。

: :open_args

IO.open に渡され...
...ng など
IO.open のオプション引数が指定できます。

@see IO.binread

例:

IO.read(empty_file) #=> ""
IO.read(empty_file, 1) #=> nil
IO.read(one_byte_file, 0, 10) #=> ""
IO.read(one_byte_file, nil, 10) #=> ""
IO.read(one_byte_file, 1, 10) #=> nil...

CSV#read -> [Array] | CSV::Table (18131.0)

残りの行を読み込んで配列の配列を返します。 self の生成時に headers オプションに偽でない値が指定されていた場合は CSV::Table オブジェクトを返します。

...= CSV.new(DATA.read)
csv.read
# => [["header1", "header2"], ["row1_1", "row1_2"], ["row2_1", "row2_2"]]

__END__
header1,header2
row1_1,row1_2
row2_1,row2_2
//}

//emlist[例 headers: true][ruby]{
require "csv"

csv = CSV.new(DATA.read, headers: true)
csv.read
# => #<CSV::Table mode:col_or_row row_...

Readline.#readline(prompt = "", add_hist = false) -> String | nil (9112.0)

prompt を出力し、ユーザからのキー入力を待ちます。 エンターキーの押下などでユーザが文字列を入力し終えると、 入力した文字列を返します。 このとき、add_hist が true であれば、入力した文字列を入力履歴に追加します。 何も入力していない状態で EOF(UNIX では ^D) を入力するなどで、 ユーザからの入力がない場合は nil を返します。

...:

require "readline"

input = Readline.readline
(プロンプトなどは表示せずに、入力待ちの状態になります。
ここでは「abc」を入力後、エンターキーを押したと想定します。)
abc

p input # => "abc"

input = Readline.readline("> ")
(">"...
...s

p input # => "ls"

input = Readline.readline("> ", true)
(">"を表示し、入力待ちの状態になります。
ここでは「cd」を入力後、エンターキーを押したと想定します。)
> cd

p input # => "cd"

input = Readline.readline("> ", true)
(">"を表示...
...to_a
Read
line::HISTORY.pop if /^\s*$/ =~ buf

begin
if Readline::HISTORY[Readline::HISTORY.length-2] == buf
Read
line::HISTORY.pop
end
rescue IndexError
end

# p Readline::HISTORY.to_a
print "-> ", buf, "\n"
end

@see Readline.vi_editing_modeReadline...

絞り込み条件を変える

Readline.emacs_editing_mode -> nil (9101.0)

編集モードを Emacs モードにします。デフォルトは Emacs モードです。

...Emacs モードにします。デフォルトは Emacs モードです。

Emacs モードの詳細は、 GNU Readline のマニュアルを参照してください。

* http://www.gnu.org/directory/readline.html

@raise NotImplementedError サポートしていない環境で発生します。...

Readline.vi_editing_mode -> nil (9101.0)

編集モードを vi モードにします。 vi モードの詳細は、GNU Readline のマニュアルを参照してください。

...編集モードを vi モードにします。
vi モードの詳細は、GNU Readline のマニュアルを参照してください。

* http://www.gnu.org/directory/readline.html

@raise NotImplementedError サポートしていない環境で発生します。...

CSV#readlines -> [Array] | CSV::Table (6131.0)

残りの行を読み込んで配列の配列を返します。 self の生成時に headers オプションに偽でない値が指定されていた場合は CSV::Table オブジェクトを返します。

...= CSV.new(DATA.read)
csv.read
# => [["header1", "header2"], ["row1_1", "row1_2"], ["row2_1", "row2_2"]]

__END__
header1,header2
row1_1,row1_2
row2_1,row2_2
//}

//emlist[例 headers: true][ruby]{
require "csv"

csv = CSV.new(DATA.read, headers: true)
csv.read
# => #<CSV::Table mode:col_or_row row_...

ARGF.class#binmode -> self (6112.0)

self をバイナリモードにします。一度バイナリモードになった後は非バイナリ モードに戻る事はできません。

...test1.png + test2.png = 292B

# $ ruby test.rb test1.png test2.png

ARGF.binmode
ARGF.read.size # => 292

例:
# test1.png - 164B
# test2.png - 128B
# test1.png + test2.png = 292B

# $ ruby test.rb test1.png test2.png

ARGF.read.size # => 290

@see IO#binmode, ARGF.class#binmode?...

IO.binread(path, length = nil, offset = 0) -> String | nil (6112.0)

path で指定したファイルを open し、offset の所まで seek し、 length バイト読み込みます。

...くときの mode は "rb:ASCII-8BIT" です。

//emlist[例][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...\n")
IO.binread("testfile") # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
IO.binread("testfile", 2...
...0) # => "This is line one\nThi"
IO.binread("testfile", 20, 10) # => "ne one\nThis is line "
//}

@see IO.read...

絞り込み条件を変える

<< 1 2 3 ... > >>