るりまサーチ

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

別のキーワード

  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 (27344.0)

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

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

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

$ 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#r...

ARGF.class#readbyte -> Integer (21413.0)

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

...Error が発生します。

@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 (EOFErr...
...or)...

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

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

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

//emlist[例][ruby]{
r
equire "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#readchar -> String (15313.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...

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

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

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

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

# => ["line", "example.rb", 4, nil, #<Binding:0x00007f98e107d0d8>, nil]
# => ["c-call", "example.rb", 4, :inherited...
...8e1087448>, Class]
# => ["c-return", "example.rb", 4, :inherited, #<Binding:0x00007f98e1085d00>, Class]
# => ["class", "example.rb", 4, nil, #<Binding:0x00007f98e108f210>, nil]
# => ["end", "example.rb", 5, nil, #<Binding:0x00007f98e108e5e0>, nil]
# => ["line", "example.rb", 6, nil, #<Binding:0x0000...
...7f98e108d4b0>, 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 (15225.0)

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

...

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

# => ["line", "example.rb", 2, nil, #<Binding:0x00007fc8de87cb08>, nil]
# => ["c-call", "example.rb", 2, :inherited, #<Binding:...
...8de886770>, Class]
# => ["c-return", "example.rb", 2, :inherited, #<Binding:0x00007fc8de8844e8>, Class]
# => ["class", "example.rb", 2, nil, #<Binding:0x00007fc8de88e830>, nil]
# => ["end", "example.rb", 3, nil, #<Binding:0x00007fc8de88d6b0>, nil]
# => ["line", "example.rb", 4, nil, #<Binding:0x0000...
...ample.rb", 4, :to_s, #<Binding:0x00007fc8de896f30>, Integer]
# => ["c-return", "example.rb", 4, :to_s, #<Binding:0x00007fc8de894a50>, Integer]
# => ["line", "example.rb", 5, nil, #<Binding:0x00007fc8de967b08>, nil]
# => ["c-call", "example.rb", 5, :current, #<Binding:0x00007fc8de967798>, Thread]
# =...

ARGF.class#path -> String (9219.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"...

ARGF.class#filename -> String (6219.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"...

ERB#def_class(superklass=Object, methodname=&#39;erb&#39;) -> Class (3299.0)

変換した Ruby スクリプトをメソッドとして定義した無名のクラスを返します。

... Ruby スクリプトをメソッドとして定義した無名のクラスを返します。


@param superklass 無名クラスのスーパークラス

@param methodname メソッド名

//emlist[例][ruby]{
r
equire 'erb'

class MyClass_
def initialize(arg1, arg2)
@arg1 = arg1; @arg2 = ar...
...g2
end
end
filename = 'example.rhtml' # @arg1 と @arg2 が使われている example.rhtml

erb = ERB.new(File.read(filename))
erb.filename = filename
MyClass = erb.def_class(MyClass_, 'render()')
print MyClass.new('foo', 123).render()

# => test1foo
# test2123
//}...
<< 1 2 > >>