るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

ARGF.class#read(length = nil, str = nil) -> String | nil (21144.0)

ARGVに指定されたファイルを先頭のファイルからlengthバイト読み込み、 その文字列をstrに出力します。読み込んだ文字列を返します。

...
ARG
Vに指定されたファイルを先頭のファイルからlengthバイト読み込み、
その文字列をstrに出力します。読み込んだ文字列を返します。

@param length 読み込むバイト数を指定します。nilの場合はARGVのすべてのファ
...
...tr 出力先の文字列。内容は上書きされます。

$ echo "small" > small.txt
$ echo "large" > large.txt
$ ruby glark.rb small.txt large.txt

ARG
F.read # => "small\nlarge"
ARG
F.read(200) # => "small\nlarge"
ARG
F.read(2) # => "sm"
ARG
F.read(0) # => ""

@see IO#read...

ARGF.class#readbyte -> Integer (9113.0)

自身から 1 バイトを読み込み整数として返します。 既に EOF に達していれば EOFError が発生します。

...が発生します。

@raise EOFError 既に EOF に達している場合に発生します。

$ echo "foo" > file
$ ruby argf.rb file

ARG
F.readbyte # => 102
ARG
F.readbyte # => 111
ARG
F.readbyte # => 111
ARG
F.readbyte # => 10
ARG
F.readbyte # => end of file reached (EOFError)...

ARGF.class#readchar -> String (9113.0)

ARGFから 1 文字読み込んで、その文字に対応する String を返します。EOF に 到達した時には EOFErrorを発生します。

...
ARG
Fから 1 文字読み込んで、その文字に対応する String を返します。EOF に
到達した時には EOFErrorを発生します。

@raise EOFError EOFに達した時発生する

$ echo "foo" > file
$ ruby argf.rb file

ARG
F.readchar # => "f"
ARG
F.readchar # => "o"
A...
...RGF.readchar # => "o"
ARG
F.readchar # => "\n"
ARG
F.readchar # => end of file reached (EOFError)

@see ARGF.class#getc...

Pathname#binread(*args) -> String | nil (6213.0)

IO.binread(self.to_s, *args)と同じです。

....binread(self.to_s, *args)と同じです。

//emlist[例][ruby]{
require "pathname"

pathname = Pathname("testfile")
pathname.binread # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
pathname.binread(20) # => "This is line one\nThi"
pathname.binread(20,...
...10) # => "ne one\nThis is line "
//}

@see IO.binread...

ARGF.class#binmode -> self (3037.0)

self をバイナリモードにします。一度バイナリモードになった後は非バイナリ モードに戻る事はできません。

...test1.png + test2.png = 292B

# $ ruby test.rb test1.png test2.png

ARG
F.binmode
ARG
F.read.size # => 292

例:
# test1.png - 164B
# test2.png - 128B
# test1.png + test2.png = 292B

# $ ruby test.rb test1.png test2.png

ARG
F.read.size # => 290

@see IO#binmode, ARGF.class#binmode?...

絞り込み条件を変える

Thread#add_trace_func(pr) -> Proc (3025.0)

スレッドにトレース用ハンドラを追加します。

...ドラを返します。

@param pr トレースハンドラ(Proc オブジェクト)

//emlist[例][ruby]{
th = Thread.new do
class Trace
end
43.to_s
end
th.add_trace_func lambda {|*arg| p arg }
th.join

# => ["line", "example.rb", 4, nil, #<Binding:0x00007f98e107d0d8>, nil]
# => ["c-call", "...
...e0>, nil]
# => ["line", "example.rb", 6, nil, #<Binding:0x00007f98e108d4b0>, nil]
# => ["c-call", "example.rb", 6, :to_s, #<Binding:0x00007f98e1097aa0>, Integer]
# => ["c-return", "example.rb", 6, :to_s, #<Binding:0x00007f98e1095cc8>, Integer]
//}

@see Thread#set_trace_func Kernel.#set_trace_func...

Thread#set_trace_func(pr) -> Proc | nil (3025.0)

スレッドにトレース用ハンドラを設定します。

...解除します。

設定したハンドラを返します。

//emlist[例][ruby]{
th = Thread.new do
class Trace
end
2.to_s
Thread.current.set_trace_func nil
3.to_s
end
th.set_trace_func lambda {|*arg| p arg }
th.join

# => ["line", "example.rb", 2, nil, #<Binding:0x00007fc8de87cb08>, n...
...8de967798>, Thread]
# => ["c-return", "example.rb", 5, :current, #<Binding:0x00007fc8de9673b0>, Thread]
# => ["c-call", "example.rb", 5, :set_trace_func, #<Binding:0x00007fc8de966fc8>, Thread]
//}

@param pr トレースハンドラ(Proc オブジェクト) もしくは nil
@see Thread#add_trace_fun...

ARGF.class#file -> IO (3019.0)

現在開いている処理対象の File オブジェクト(または IO オブジェ クト)を返します。

...オブジェ
クト)を返します。

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

$ ruby argf.rb foo bar

ARG
F.file # => #<File:foo>
ARG
F.read(5) # => "foo\nb"
ARG
F.file # => #<File:bar>

ARG
Fが現在開いている処理対象が標準入力の場合、$stdin を返します...

ARGF.class#filename -> String (3019.0)

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

...は - を返します。
組み込み変数 $FILENAME と同じです。

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

$ ruby argf.rb foo bar glark

ARG
F.filename # => "foo"
ARG
F.read(5) # => "foo\nb"
ARG
F.filename # => "bar"
ARG
F.skip
ARG
F.filename # => "glark"...
<< 1 2 > >>