別のキーワード
ライブラリ
クラス
-
ARGF
. class (12) - CSV (84)
-
CSV
:: Table (12) - File (36)
- IO (216)
-
IRB
:: Context (24) - StringIO (24)
- Tempfile (33)
モジュール
- JSON (6)
- Kernel (64)
- OpenURI (24)
-
OpenURI
:: OpenRead (24) - Readline (36)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - ERB (12)
-
NEWS for Ruby 2
. 2 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 2
. 6 . 0 (7) -
NEWS for Ruby 3
. 0 . 0 (5) - SSLSocket (12)
- binmode (12)
- binread (12)
- cgi (12)
-
emacs
_ editing _ mode (12) - inspect (12)
- load (3)
- new (35)
- open (134)
-
open
_ uri (24) - popen (168)
- readline (12)
- readlines (12)
- reopen (24)
- restore (3)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) - spawn (48)
-
use
_ readline (12) -
use
_ readline? (12) -
vi
_ editing _ mode (12)
検索結果
先頭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?...