別のキーワード
ライブラリ
クラス
-
ARGF
. class (11) - CSV (77)
-
CSV
:: Table (11) - File (33)
- IO (198)
-
IRB
:: Context (22) - StringIO (22)
- Tempfile (30)
モジュール
- JSON (6)
- Kernel (60)
- OpenURI (22)
-
OpenURI
:: OpenRead (22) - Readline (33)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - ERB (11)
-
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (4) - binmode (11)
- binread (11)
- cgi (11)
-
emacs
_ editing _ mode (11) - inspect (11)
- load (3)
- new (32)
- open (124)
-
open
_ uri (22) - popen (154)
- readline (11)
- readlines (11)
- reopen (22)
- restore (3)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 feature (11) - spawn (44)
-
use
_ readline (11) -
use
_ readline? (11) -
vi
_ editing _ mode (11)
検索結果
先頭5件
-
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
Readline::HISTORY.pop if /^\s*$/ =~ buf
begin
if Readline::HISTORY[Readline::HISTORY.length-2] == buf
Readline::HISTORY.pop
end
rescue IndexError
end
# p Readline::HISTORY.to_a
print "-> ", buf, "\n"
end
@see Readline.vi_editing_mode、Readline... -
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...