るりまサーチ (Ruby 3.1)

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

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils cp_r
  5. fileutils rm_r

検索結果

Fiddle::Closure::BlockCaller#call(*args) -> object (81607.0)

wrap しているブロックを呼び出します。

wrap しているブロックを呼び出します。

そのブロックの返り値がこのメソッドの返り値となります。

@param args 引数

Fiddle::Function#call(*args) -> Integer|DL::CPtr|nil (63607.0)

関数を呼び出します。

関数を呼び出します。

Fiddle::Function.new で指定した引数と返り値の型に基いて
Ruby のオブジェクトを適切に C のデータに変換して C の関数を呼び出し、
その返り値を Ruby のオブジェクトに変換して返します。

引数の変換は以下の通りです。

: void* (つまり任意のポインタ型)
nil ならば C の NULL に変換されます
Fiddle::Pointer は保持している C ポインタに変換されます。
文字列であればその先頭ポインタになります。
IO オブジェクトであれば FILE* が渡されます。
整数であればそれがアドレスとみ...

Continuation#call(*ret) -> () (54607.0)

self が記憶した状態を継続します。引数は そのまま Kernel.#callcc の戻り値になります。

self が記憶した状態を継続します。引数は そのまま
Kernel.#callcc の戻り値になります。

@param ret 継続に復帰した時に返す値を指定します。

Hash#default_proc -> Proc | nil (36922.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) -> () (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...

絞り込み条件を変える

Module#ruby2_keywords(method_name, ...) -> nil (36700.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

For the given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword argument...

Proc#ruby2_keywords -> proc (36700.0)

Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.

Marks the proc as passing keywords through a normal argument splat. This
should only be called on procs that accept an argument splat (`*args`)
but not explicit keywords or a keyword splat. It marks the proc such
that if the proc is called with keyword arguments, the final hash
argument is marked ...

Method#curry -> Proc (36694.0)

self を元にカリー化した Proc を返します。

self を元にカリー化した Proc を返します。

カリー化した Proc はいくつかの引数をとります。十分な数の引数が与
えられると、元の Proc に引数を渡し て実行し、結果を返します。引数
の個数が足りないときは、部分適用したカリー化 Proc を返します。

@param arity 引数の個数を指定します。可変長の引数を指定できるメソッドを
カリー化する際には必ず指定する必要があります。

//emlist[例][ruby]{
def foo(a,b,c)
[a, b, c]
end

proc = self.method(:foo).curr...

Method#curry(arity) -> Proc (36694.0)

self を元にカリー化した Proc を返します。

self を元にカリー化した Proc を返します。

カリー化した Proc はいくつかの引数をとります。十分な数の引数が与
えられると、元の Proc に引数を渡し て実行し、結果を返します。引数
の個数が足りないときは、部分適用したカリー化 Proc を返します。

@param arity 引数の個数を指定します。可変長の引数を指定できるメソッドを
カリー化する際には必ず指定する必要があります。

//emlist[例][ruby]{
def foo(a,b,c)
[a, b, c]
end

proc = self.method(:foo).curr...

Thread#set_trace_func(pr) -> Proc | nil (36676.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]
#...

絞り込み条件を変える

UnboundMethod#bind_call(recv, *args) -> object (36664.0)

self を recv に bind して args を引数として呼び出します。

self を recv に bind して args を引数として呼び出します。

self.bind(recv).call(*args) と同じ意味です。

//emlist[][ruby]{
puts Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}

@see UnboundMethod#bind, Method#call

UnboundMethod#bind_call(recv, *args) { ... } -> object (36664.0)

self を recv に bind して args を引数として呼び出します。

self を recv に bind して args を引数として呼び出します。

self.bind(recv).call(*args) と同じ意味です。

//emlist[][ruby]{
puts Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}

@see UnboundMethod#bind, Method#call

Method#super_method -> Method | nil (36640.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...

Thread#add_trace_func(pr) -> Proc (36640.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, ...

WEBrick::HTTPServer#mount_proc(dir) {|req, res| ...} -> () (36622.0)

サーバ上のディレクトリ dir にリクエストを処理する Proc オブジェクト proc を対応させます。

サーバ上のディレクトリ dir にリクエストを処理する Proc オブジェクト proc を対応させます。

@param dir ディレクトリをあらわす文字列を指定します。

@param proc リクエストを処理する Proc オブジェクトを指定します。
WEBrick::HTTPResponse オブジェクトと WEBrick::HTTPRequest
オブジェクトを引数として proc.call(request, response) の引数の順で呼び出されます。

@raise WEBrick::HTTPServerError pr...

絞り込み条件を変える

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

LocalJumpError#exit_value -> object (27340.0)

例外 LocalJumpError を発生する原因となった break や return に渡した値を返します。

例外 LocalJumpError を発生する原因となった
break や return に渡した値を返します。

例:

def foo
proc { return 10 }
end

begin
foo.call
rescue LocalJumpError => err
p err # => #<LocalJumpError: return from block-closure>
p err.reason # => :return
p err.exit_value # => 10
e...

LocalJumpError#reason -> Symbol (27340.0)

例外を発生させた原因をシンボルで返します。

例外を発生させた原因をシンボルで返します。

返す値は以下のいずれかです。

* :break
* :redo
* :retry
* :next
* :return
* :noreason

例:

def foo
proc { return 10 }
end

begin
foo.call
rescue LocalJumpError => err
p err # => #<LocalJumpError: return from block-closure>
p err.reason ...

Enumerable#detect(ifnone = nil) -> Enumerator (18640.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 } ...

Enumerable#find(ifnone = nil) -> Enumerator (18640.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 } ...

絞り込み条件を変える

Exception#full_message(highlight: true, order: :bottom) -> String (18640.0)

例外の整形された文字列を返します。

例外の整形された文字列を返します。

返される文字列は Ruby が捕捉されなかった例外を標準エラー出力に出力するときと
同じ形式です。
そのため、メソッド呼び出し時に $stderr が変更されておらず、$stderr.tty? が真の場合は
エスケープシーケンスによる文字装飾がついています。


@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。

@param order :top か :bottom で指定する必要があります。
...

Enumerable#detect(ifnone = nil) {|item| ... } -> object (18040.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 } ...

Enumerable#find(ifnone = nil) {|item| ... } -> object (18040.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 } ...

TracePoint#defined_class -> Class | module (9358.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...

Continuation#[](*ret) -> () (9307.0)

self が記憶した状態を継続します。引数は そのまま Kernel.#callcc の戻り値になります。

self が記憶した状態を継続します。引数は そのまま
Kernel.#callcc の戻り値になります。

@param ret 継続に復帰した時に返す値を指定します。

絞り込み条件を変える