るりまサーチ

最速Rubyリファレンスマニュアル検索!
447件ヒット [201-300件を表示] (0.071秒)

別のキーワード

  1. socket iff_echo
  2. io/console echo=
  3. io/console echo?
  4. io echo?
  5. io echo=

クラス

キーワード

検索結果

<< < 1 2 3 4 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"...
<< < 1 2 3 4 5 > >>