るりまサーチ (Ruby 3.2)

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

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. kernel p
  5. rsa p

ライブラリ

キーワード

検索結果

ARGF.class#each_codepoint -> Enumerator (18343.0)

self の各コードポイントに対して繰り返しブロックを呼びだします。

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:each_codepoint>
...

ARGF.class#each_codepoint { |c| ... } -> self (18343.0)

self の各コードポイントに対して繰り返しブロックを呼びだします。

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:each_codepoint>
...

ARGF.class#inplace_mode -> String | nil (18343.0)

c:ARGF#inplace で書き換えるファイルのバックアップに付加される拡 張子を返します。拡張子が設定されていない場合は空文字列を返します。イン プレースモードでない場合は nil を返します。

...は空文字列を返します。イン
プレースモードでない場合は nil を返します。

Ruby 起動時の -i オプション や ARGF.class#inplace_mode= で設定します。

例:
# $ echo "test" > test.txt
# $ ruby -i.bak test.rb test.txt
# $ cat test.txt # => "TEST"
# $ c...
...ine {|e|print e.upcase} # => "TEST"

例:
# $ echo "test" > test.txt
# $ ruby test.rb test.txt
# $ cat test.txt # => "test"

# test.rb
ARGF.inplace_mode # => nil
ARGF.each_line {|e|print e.upcase} # => "TEST"

@see d:spec/rubycmd#cmd_option, ARGF.class#inplace_mode=...

ARGF.class#skip -> self (18343.0)

現在開いている処理対象のファイルをクローズします。 次回の読み込みは次の引数が処理対象になります。 self を返します。

現在開いている処理対象のファイルをクローズします。
次回の読み込みは次の引数が処理対象になります。
self を返します。

$ echo "foo" > foo
$ echo "bar" > bar

$ ruby argf.rb foo bar
ARGF.filename # => "foo"
ARGF.skip
ARGF.filename # => "bar"

ARGF.class#path -> String (9361.0)

現在開いている処理対象のファイル名を返します。

現在開いている処理対象のファイル名を返します。

標準入力に対しては - を返します。
組み込み変数 $FILENAME と同じです。

$ echo "foo" > foo
$ echo "bar" > bar
$ echo "glark" > glark

$ ruby argf.rb foo bar glark

ARGF.filename # => "foo"
ARGF.read(5) # => "foo\nb"
ARGF.filename # => "bar"
ARGF.skip
ARGF.filename # => "glark"

絞り込み条件を変える

ARGF.class#gets(limit, chomp: false) -> String | nil (379.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs = $/, chomp: false) -> String | nil (379.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs, limit, chomp: false) -> String | nil (379.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#each_char -> Enumerator (61.0)

レシーバに含まれる文字を一文字ずつブロックに渡して評価します。

...ルを最後まで読んだ後は次のファイ
ルの内容を返します。現在位置の1文字についてファイル名を得るには
ARGF.class
#filename を使用します。

ブロックが与えられなかった場合は、Enumerator オブジェクトを生成し
て返します。...

ARGF.class#each_char { |c| ... } -> self (61.0)

レシーバに含まれる文字を一文字ずつブロックに渡して評価します。

...ルを最後まで読んだ後は次のファイ
ルの内容を返します。現在位置の1文字についてファイル名を得るには
ARGF.class
#filename を使用します。

ブロックが与えられなかった場合は、Enumerator オブジェクトを生成し
て返します。...

絞り込み条件を変える