ライブラリ
- ビルトイン (22)
- fiddle (1)
- openssl (1)
-
webrick
/ httpserver (2)
クラス
- BasicObject (1)
-
Fiddle
:: Function (1) - Hash (1)
- Method (1)
- NoMethodError (1)
-
OpenSSL
:: SSL :: SSLContext (1) - Proc (2)
- Thread (4)
-
Thread
:: Backtrace :: Location (4) - TracePoint (4)
-
WEBrick
:: HTTPServer (2)
モジュール
- Enumerable (4)
キーワード
-
absolute
_ path (1) -
add
_ trace _ func (1) -
base
_ label (1) - binding (1)
-
callee
_ id (1) -
default
_ proc (1) -
defined
_ class (1) - detect (2)
- find (2)
- inspect (1)
-
instance
_ eval (1) - lambda? (1)
-
method
_ id (1) -
mount
_ proc (2) -
private
_ call? (1) -
report
_ on _ exception (1) -
report
_ on _ exception= (1) -
set
_ trace _ func (1) -
super
_ method (1) -
tmp
_ dh _ callback (1) -
to
_ s (1) - yield (1)
検索結果
先頭5件
-
Fiddle
:: Function # call(*args) -> Integer|DL :: CPtr|nil (73207.0) -
関数を呼び出します。
関数を呼び出します。
Fiddle::Function.new で指定した引数と返り値の型に基いて
Ruby のオブジェクトを適切に C のデータに変換して C の関数を呼び出し、
その返り値を Ruby のオブジェクトに変換して返します。
引数の変換は以下の通りです。
: void* (つまり任意のポインタ型)
nil ならば C の NULL に変換されます
Fiddle::Pointer は保持している C ポインタに変換されます。
文字列であればその先頭ポインタになります。
IO オブジェクトであれば FILE* が渡されます。
整数であればそれがアドレスとみ... -
Thread
# add _ trace _ func(pr) -> Proc (55012.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", "example.rb", 4, ... -
TracePoint
# callee _ id -> Symbol | nil (54922.0) -
イベントが発生したメソッドの呼ばれた名前を Symbol で返します。 トップレベルであった場合は nil を返します。
イベントが発生したメソッドの呼ばれた名前を Symbol で返します。
トップレベルであった場合は nil を返します。
@raise RuntimeError イベントフックの外側で実行した場合に発生します。
//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end
trace = TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :alias_name]
e... -
Thread
# report _ on _ exception -> bool (54622.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
デフォルトはスレッド作成時の Thread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exception # => true
a.run
# => #<Th... -
Thread
# report _ on _ exception=(newstate) (54622.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
デフォルトはスレッド作成時の Thread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exception # => true
a.run
# => #<Th... -
NoMethodError
# private _ call? -> bool (54607.0) -
メソッド呼び出しが private なメソッドを呼び出せる形式 (関数形式(レシーバを省略した形式)) で呼ばれたかどうかを返します。
メソッド呼び出しが private なメソッドを呼び出せる形式
(関数形式(レシーバを省略した形式)) で呼ばれたかどうかを返します。 -
TracePoint
# binding -> Binding (46222.0) -
発生したイベントによって生成された Binding オブジェクトを返します。
発生したイベントによって生成された Binding オブジェクトを返します。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.binding.local_variables # => [:ret]
end
trace.enable
foo 1
//} -
OpenSSL
:: SSL :: SSLContext # tmp _ dh _ callback -> Proc | nil (46204.0) -
一時的 DH 鍵を生成するためのコールバックを返します。
一時的 DH 鍵を生成するためのコールバックを返します。
@see OpenSSL::SSL::SSLContext#tmp_dh_callback= -
Enumerable
# find(ifnone = nil) -> Enumerator (45940.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
要素に対してブロックを評価した値が真になった最初の要素を返します。
真になる要素が見つからず、ifnone も指定されていないときは nil を返します。
真になる要素が見つからず、ifnone が指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlist[例][ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } ... -
Thread
# set _ trace _ func(pr) -> Proc | nil (45694.0) -
スレッドにトレース用ハンドラを設定します。
スレッドにトレース用ハンドラを設定します。
nil を渡すとトレースを解除します。
設定したハンドラを返します。
//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>, nil]
#... -
TracePoint
# defined _ class -> Class | module (45658.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 に関係なく)モジュー
ルを返します。
//emlist[例][ruby]{
module M; def foo; end; end
class C; include M; end;
trac... -
Enumerable
# find(ifnone = nil) {|item| . . . } -> object (45640.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
要素に対してブロックを評価した値が真になった最初の要素を返します。
真になる要素が見つからず、ifnone も指定されていないときは nil を返します。
真になる要素が見つからず、ifnone が指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlist[例][ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } ... -
Method
# super _ method -> Method | nil (37240.0) -
self 内で super を実行した際に実行されるメソッドを Method オブジェ クトにして返します。
self 内で super を実行した際に実行されるメソッドを Method オブジェ
クトにして返します。
@see UnboundMethod#super_method
//emlist[例][ruby]{
class Super
def foo
"superclass method"
end
end
class Sub < Super
def foo
"subclass method"
end
end
m = Sub.new.method(:foo) # => #<Method: Sub#foo>
m.call # => "subclass me... -
Hash
# default _ proc -> Proc | nil (37222.0) -
ハッシュのデフォルト値を返す Proc オブジェクトを返します。 ハッシュがブロック形式のデフォルト値を持たない場合 nil を返します。
ハッシュのデフォルト値を返す Proc オブジェクトを返します。
ハッシュがブロック形式のデフォルト値を持たない場合 nil を返します。
//emlist[例][ruby]{
h = Hash.new {|hash, key| "The #{key} not exist in #{hash.inspect}"}
p h.default #=> nil
p block = h.default_proc #=> #<Proc:0x0x401a9ff4>
p block.call({},:foo) #=> "The foo not exist in {}"
h... -
WEBrick
:: HTTPServer # mount _ proc(dir , proc) -> () (37222.0) -
サーバ上のディレクトリ dir にリクエストを処理する Proc オブジェクト proc を対応させます。
サーバ上のディレクトリ dir にリクエストを処理する Proc オブジェクト proc を対応させます。
@param dir ディレクトリをあらわす文字列を指定します。
@param proc リクエストを処理する Proc オブジェクトを指定します。
WEBrick::HTTPResponse オブジェクトと WEBrick::HTTPRequest
オブジェクトを引数として proc.call(request, response) の引数の順で呼び出されます。
@raise WEBrick::HTTPServerError pr... -
Enumerable
# detect(ifnone = nil) -> Enumerator (36940.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
要素に対してブロックを評価した値が真になった最初の要素を返します。
真になる要素が見つからず、ifnone も指定されていないときは nil を返します。
真になる要素が見つからず、ifnone が指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlist[例][ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } ... -
WEBrick
:: HTTPServer # mount _ proc(dir) {|req , res| . . . } -> () (36922.0) -
サーバ上のディレクトリ dir にリクエストを処理する Proc オブジェクト proc を対応させます。
サーバ上のディレクトリ dir にリクエストを処理する Proc オブジェクト proc を対応させます。
@param dir ディレクトリをあらわす文字列を指定します。
@param proc リクエストを処理する Proc オブジェクトを指定します。
WEBrick::HTTPResponse オブジェクトと WEBrick::HTTPRequest
オブジェクトを引数として proc.call(request, response) の引数の順で呼び出されます。
@raise WEBrick::HTTPServerError pr... -
Enumerable
# detect(ifnone = nil) {|item| . . . } -> object (36640.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
要素に対してブロックを評価した値が真になった最初の要素を返します。
真になる要素が見つからず、ifnone も指定されていないときは nil を返します。
真になる要素が見つからず、ifnone が指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlist[例][ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } ... -
Thread
:: Backtrace :: Location # inspect -> String (36640.0) -
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文
字列に変換したオブジェクトを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.inspect
end
# => "path/to/foo.rb:5:in ... -
TracePoint
# method _ id -> Symbol | nil (36622.0) -
イベントが発生したメソッドの定義時の名前を Symbol で返します。 トップレベルであった場合は nil を返します。
イベントが発生したメソッドの定義時の名前を Symbol で返します。
トップレベルであった場合は nil を返します。
@raise RuntimeError イベントフックの外側で実行した場合に発生します。
//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end
trace = TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :alias_name]
e... -
Thread
:: Backtrace :: Location # absolute _ path -> String (27640.0) -
self が表すフレームの絶対パスを返します。
self が表すフレームの絶対パスを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end
# => /path/to/foo.rb
# /path/to/foo.rb
# /path/to/foo.rb
//}
@see... -
Thread
:: Backtrace :: Location # base _ label -> String (27640.0) -
self が表すフレームの基本ラベルを返します。通常、 Thread::Backtrace::Location#label から修飾を取り除いたもので構成 されます。
self が表すフレームの基本ラベルを返します。通常、
Thread::Backtrace::Location#label から修飾を取り除いたもので構成
されます。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.base_label
end
# => init... -
Thread
:: Backtrace :: Location # to _ s -> String (27640.0) -
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し
ます。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.to_s
end
# => path/to/foo.rb:5:in `initialize'
# path/to/foo... -
Proc
# lambda? -> bool (27502.0) -
手続きオブジェクトの引数の取扱が厳密であるならば true を返します。
手続きオブジェクトの引数の取扱が厳密であるならば true を返します。
引数の取扱の厳密さの意味は以下の例を参考にしてください。
//emlist[例][ruby]{
# lambda で生成した Proc オブジェクトでは true
lambda{}.lambda? # => true
# proc で生成した Proc オブジェクトでは false
proc{}.lambda? # => false
# Proc.new で生成した Proc オブジェクトでは false
Proc.new{}.lambda? # => false
# 以下、lambda?が偽である場合
#... -
Proc
# yield(*arg) -> () (18787.0) -
手続きオブジェクトを実行してその結果を返します。
手続きオブジェクトを実行してその結果を返します。
引数の渡され方はオブジェクトの生成方法によって異なります。
詳しくは Proc#lambda? を参照してください。
「===」は when の所に手続きを渡せるようにするためのものです。
//emlist[例][ruby]{
def sign(n)
case n
when lambda{|n| n > 0} then 1
when lambda{|n| n < 0} then -1
else 0
end
end
p sign(-4) #=> -1
p sign(0) #=> 0
p sign(7) #=> 1... -
BasicObject
# instance _ eval(expr , filename = "(eval)" , lineno = 1) -> object (18694.0) -
オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。
オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを
評価してその結果を返します。
オブジェクトのコンテキストで評価するとは評価中の self をそのオブジェクトにして実行するということです。
また、文字列 expr やブロック中でメソッドを定義すればそのオブジェクトの特異メソッドが定義されます。
ただし、ローカル変数だけは、文字列 expr の評価では instance_eval の外側のスコープと、ブロックの評価ではそのブロックの外側のスコープと、共有します。
メソッド定義の中で instance_eval でメソッドを定義した場...