ライブラリ
- ビルトイン (297)
-
io
/ console (36) -
irb
/ context (36) - shell (24)
-
shell
/ builtin-command (6) -
shell
/ command-processor (24) -
shell
/ filter (24)
クラス
-
ARGF
. class (252) - Array (21)
- IO (36)
-
IRB
:: Context (36) - Shell (24)
-
Shell
:: CommandProcessor (24) -
Shell
:: Echo (6) -
Shell
:: Filter (24) - String (24)
キーワード
- cat (18)
- chr (12)
- close (12)
- closed? (12)
- each (6)
-
each
_ char (24) -
each
_ codepoint (24) - echo= (24)
- echo? (24)
- eof (12)
- eof? (12)
- file (12)
- filename (12)
- getbyte (12)
- getc (12)
- gets (36)
- glob (18)
-
inplace
_ mode (12) - noecho (12)
- pack (21)
- path (12)
- read (12)
- readbyte (12)
- readchar (12)
- skip (12)
- tee (18)
- unpack (12)
検索結果
先頭5件
-
ARGF
. class # each _ char { |c| . . . } -> self (13.0) -
レシーバに含まれる文字を一文字ずつブロックに渡して評価します。
...す。
ブロックが与えられなかった場合は、Enumerator オブジェクトを生成し
て返します。
例:
# $ echo "line1\n" > test1.txt
# $ echo "line2\n" > test2.txt
# $ ruby test.rb test1.txt test2.txt
# test.rb
ARGF.each_char # => #<Enumerator: ARGF:each_c... -
ARGF
. class # each _ codepoint -> Enumerator (13.0) -
self の各コードポイントに対して繰り返しブロックを呼びだします。
...イントを表す整数が渡されます。
ブロックを省略した場合には、Enumerator を返します。
例:
# $ echo "line1\n" > test1.txt
# $ echo "line2\n" > test2.txt
# $ ruby test.rb test1.txt test2.txt
# test.rb
ARGF.each_codepoint # => #<Enumerator:... -
ARGF
. class # each _ codepoint { |c| . . . } -> self (13.0) -
self の各コードポイントに対して繰り返しブロックを呼びだします。
...イントを表す整数が渡されます。
ブロックを省略した場合には、Enumerator を返します。
例:
# $ echo "line1\n" > test1.txt
# $ echo "line2\n" > test2.txt
# $ ruby test.rb test1.txt test2.txt
# test.rb
ARGF.each_codepoint # => #<Enumerator:... -
ARGF
. class # file -> IO (13.0) -
現在開いている処理対象の File オブジェクト(または IO オブジェ クト)を返します。
...現在開いている処理対象の File オブジェクト(または IO オブジェ
クト)を返します。
$ echo "foo" > foo
$ echo "bar" > bar
$ ruby argf.rb foo bar
ARGF.file # => #<File:foo>
ARGF.read(5) # => "foo\nb"
ARGF.file # => #<File:bar>
ARGFが現在開... -
ARGF
. class # getbyte -> Integer | nil (13.0) -
self から 1 バイト(0..255)を読み込み整数として返します。 既に EOF に達していれば nil を返します。
...ェ
クトです。そのため、最初のファイルを最後まで読んだ後は次のファイルの内
容を返します。
$ echo "foo" > file1
$ echo "bar" > file2
$ ruby argf.rb file1 file2
ARGF.getbyte # => 102
ARGF.getbyte # => 111
ARGF.getbyte # => 111
ARGF.getbyte # =>... -
ARGF
. class # getc -> String | nil (13.0) -
self から 1 文字読み込んで返します。EOF に到達した時には nil を返します。
...ェ
クトです。そのため、最初のファイルを最後まで読んだ後は次のファイルの内
容を返します。
$ echo "foo" > file1
$ echo "bar" > file2
$ ruby argf.rb file1 file2
ARGF.getc # => "f"
ARGF.getc # => "o"
ARGF.getc # => "o"
ARGF.getc # => "\n"
ARGF... -
ARGF
. class # inplace _ mode -> String | nil (13.0) -
c:ARGF#inplace で書き換えるファイルのバックアップに付加される拡 張子を返します。拡張子が設定されていない場合は空文字列を返します。イン プレースモードでない場合は nil を返します。
...ます。
例:
# $ echo "test" > test.txt
# $ ruby -i.bak test.rb test.txt
# $ cat test.txt # => "TEST"
# $ cat test.txt.bak # => "test"
# test.rb
ARGF.inplace_mode # => ".bak"
ARGF.each_line {|e|print e.upcase} # => "TEST"
例:
# $ echo "test" > test.txt
# $... -
ARGF
. class # read(length = nil , str = nil) -> String | nil (13.0) -
ARGVに指定されたファイルを先頭のファイルからlengthバイト読み込み、 その文字列をstrに出力します。読み込んだ文字列を返します。
...てのファ
イルを読み込みます。
@param str 出力先の文字列。内容は上書きされます。
$ echo "small" > small.txt
$ echo "large" > large.txt
$ ruby glark.rb small.txt large.txt
ARGF.read # => "small\nlarge"
ARGF.read(200) # => "small\nlarge"... -
ARGF
. class # skip -> self (13.0) -
現在開いている処理対象のファイルをクローズします。 次回の読み込みは次の引数が処理対象になります。 self を返します。
...いている処理対象のファイルをクローズします。
次回の読み込みは次の引数が処理対象になります。
self を返します。
$ echo "foo" > foo
$ echo "bar" > bar
$ ruby argf.rb foo bar
ARGF.filename # => "foo"
ARGF.skip
ARGF.filename # => "bar"...