389件ヒット
[1-100件を表示]
(0.131秒)
クラス
-
ARGF
. class (75) - BasicObject (24)
- Module (120)
- Object (108)
- Thread (24)
- TracePoint (12)
モジュール
- Exception2MessageMapper (6)
- Kernel (20)
キーワード
- DelegateClass (12)
-
add
_ trace _ func (12) - ancestors (12)
- autoload (12)
-
class
_ eval (24) -
const
_ defined? (12) - constants (12)
-
defined
_ class (12) - gets (27)
- include (12)
- inspect (12)
-
instance
_ eval (24) -
instance
_ variables (12) -
module
_ eval (24) -
pretty
_ print (12) - print (12)
- printf (12)
- putc (12)
- puts (12)
-
remove
_ const (12) - send (24)
-
set
_ trace _ func (12) - timeout (8)
-
to
_ ary (12) -
to
_ int (12) -
to
_ str (12)
検索結果
先頭5件
-
Object
# class -> Class (18299.0) -
レシーバのクラスを返します。
...レシーバのクラスを返します。
//emlist[][ruby]{
p "ruby".class #=> String
p 100.class #=> Integer
p ARGV.class #=> Array
p self.class #=> Object
p Class.class #=> Class
p Kernel.class #=> Module
//}
@see Class#superclass,Object#kind_of?,Object#instance_of?... -
Kernel
# DelegateClass(superclass) -> object (15325.0) -
クラス superclass のインスタンスへメソッドを委譲するクラスを定義し、 そのクラスを返します。
...perclass のインスタンスへメソッドを委譲するクラスを定義し、
そのクラスを返します。
@param superclass 委譲先となるクラス
例:
//emlist{
require 'delegate'
class ExtArray < DelegateClass(Array)
def initialize
super([])
end
end
a = ExtArray.new
p......a.class # => ExtArray
a.push 25
p a # => [25]
//}... -
Object
# pretty _ print(pp) -> () (12223.0) -
PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに 呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。
...
PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに
呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。
あるクラスの pp の出力をカスタマイズしたい場合は、このメソッドを再定義します。
そのと...... pretty_print メソッドは指定された pp に対して表示したい自身の内容を追加して
いかなければいけません。いくつかの組み込みクラスについて、
pp ライブラリはあらかじめ pretty_print メソッドを定義しています。
@param pp PP......ブジェクトです。
//emlist[][ruby]{
require 'pp'
class Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
end
//}
@see Object#pretty_print_cycle, Object#inspect, PrettyPrint#text, PrettyPrint#group, PrettyPrint#breakable......オブジェクトです。
//emlist[][ruby]{
class Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
end
//}
@see Object#pretty_print_cycle, Object#inspect, PrettyPrint#text, PrettyPrint#group, PrettyPrint#breakable... -
TracePoint
# defined _ class -> Class | module (9281.0) -
メソッドを定義したクラスかモジュールを返します。
...メソッドを定義したクラスかモジュールを返します。
//emlist[例][ruby]{
class C; def foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => C
end.enable do
C.new.foo
end
//}
メソッドがモジュールで定義されていた場合も(include に......e M; def foo; end; end
class C; include M; end;
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => M
end.enable do
C.new.foo
end
//}
[注意] 特異メソッドを実行した場合は TracePoint#defined_class は特異クラ
スを返します。また、Kernel.#set_trace_func の 6......はなく元のクラスを返します。
//emlist[例][ruby]{
class C; def self.foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => #<Class:C>
end.enable do
C.foo
end
//}
Kernel.#set_trace_func と TracePoint の上記の差分に注意して
ください。
@see 508... -
Kernel
# timeout(sec , exception _ class = nil) {|i| . . . . } -> object (9214.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...ます。
exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはいります。
また sec が 0 もしくは nil のときは制限時間なしで
ブロックを実行します。
@param sec タ......イムアウトする時間を秒数で指定します.
@param exception_class タイムアウトした時、発生させる例外を指定します.
=== 注意
timeout による割り込みは Thread によって実現されています。C 言語
レベルで実装され、Ruby のスレッド......ルでは少ないのですが、例をあげると Socket などは
DNSの名前解決に時間がかかった場合割り込めません
(resolv-replace を使用する必要があります)。
その処理を Ruby で実装しなおすか C 側で Ruby
のスレッドを意識してあげる必... -
ARGF
. class # print(*arg) -> nil (9107.0) -
引数を順に処理対象のファイルに出力します。
...引数を順に処理対象のファイルに出力します。
c:ARGF#inplace時にのみ使用できます。
また $stdout への代入の影響を受けません。
それ以外は Kernel.#print と同じです。
@param arg 出力するオブジェクトを任意個指定します。... -
ARGF
. class # printf(format , *arg) -> nil (9107.0) -
C 言語の printf と同じように、format に従い引数を 文字列に変換して処理対象のファイルに出力します。
... printf と同じように、format に従い引数を
文字列に変換して処理対象のファイルに出力します。
c:ARGF#inplace時にのみ使用できます。
また $stdout への代入の影響を受けません。
それ以外は出力先を指定しない形式の Kernel.#print......f と同じです。
@param format フォーマット文字列です。
@param arg フォーマットされる引数です。... -
ARGF
. class # putc(ch) -> object (9107.0) -
文字 ch を処理対象のファイルに出力します。 ch を返します。
...対象のファイルに出力します。
ch を返します。
c:ARGF#inplace時にのみ使用できます。
また $stdout への代入の影響を受けません。
それ以外は Kernel.#putc と同じです。
@param ch 出力する文字を String オブジェクトで指定します。... -
ARGF
. class # puts(*arg) -> nil (9107.0) -
引数と改行を順番に処理対象のファイルに出力します。 引数がなければ改行のみを出力します。
...力します。
引数がなければ改行のみを出力します。
c:ARGF#inplace時にのみ使用できます。
また $stdout への代入の影響を受けません。
それ以外は Kernel.#puts と同じです。
@param arg 出力するオブジェクトを任意個指定します。...