種類
- インスタンスメソッド (351)
- 特異メソッド (100)
- モジュール関数 (67)
- クラス (44)
ライブラリ
- ビルトイン (562)
クラス
- BasicObject (22)
- Hash (11)
- LocalJumpError (22)
- Method (72)
- Module (11)
- Object (11)
- Proc (29)
- SystemCallError (44)
- Thread (54)
-
Thread
:: Backtrace :: Location (44) - TracePoint (116)
- UnboundMethod (15)
モジュール
- Kernel (67)
キーワード
- === (18)
- Location (11)
- Method (11)
- Proc (11)
- UnboundMethod (11)
- [] (11)
- abort (10)
-
absolute
_ path (11) -
add
_ trace _ func (11) -
base
_ label (11) - bind (5)
-
bind
_ call (10) - binding (11)
-
callee
_ id (11) - clone (11)
-
default
_ proc (11) -
defined
_ class (11) - event (11)
-
exit
_ value (11) - fail (11)
- inspect (22)
-
instance
_ eval (22) -
instance
_ method (11) - lambda (17)
- lambda? (11)
- lineno (11)
-
method
_ id (11) - parameters (6)
- path (11)
- proc (18)
- raise (11)
- reason (11)
-
report
_ on _ exception (16) -
report
_ on _ exception= (16) -
set
_ trace _ func (11) -
singleton
_ method (11) -
super
_ method (10) -
to
_ proc (11) -
to
_ s (11) - trace (11)
検索結果
先頭5件
-
SystemCallError
. new(errno) -> SystemCallError (29222.0) -
整数 errno に対応する Errno::EXXX オブジェクトを生成して返します。
...は SystemCallError の直接のインスタンスではなく、サブクラスのインスタンスです。
それらのサブクラスは Errno モジュール内に定義されています。
対応するサブクラスが存在しないコードを与えた場合には、 SystemCallError の......ときに発生します。
例:
p SystemCallError.new("message", 2)
# => #<Errno::ENOENT: No such file or directory - message>
p SystemCallError.new(2)
# => #<Errno::ENOENT: No such file or directory>
p SystemCallError.new(256)
# => #<SystemCallError: Unknown error 256>... -
SystemCallError
. new(error _ message , errno) -> SystemCallError (29222.0) -
整数 errno に対応する Errno::EXXX オブジェクトを生成して返します。
...は SystemCallError の直接のインスタンスではなく、サブクラスのインスタンスです。
それらのサブクラスは Errno モジュール内に定義されています。
対応するサブクラスが存在しないコードを与えた場合には、 SystemCallError の......ときに発生します。
例:
p SystemCallError.new("message", 2)
# => #<Errno::ENOENT: No such file or directory - message>
p SystemCallError.new(2)
# => #<Errno::ENOENT: No such file or directory>
p SystemCallError.new(256)
# => #<SystemCallError: Unknown error 256>... -
SystemCallError
. new(error _ message) -> SystemCallError (29212.0) -
SystemCallError オブジェクトを生成して返します。
...SystemCallError オブジェクトを生成して返します。
@param error_message エラーメッセージを表す文字列
例:
p SystemCallError.new("message")
# => #<SystemCallError: unknown error - message>... -
Proc
. new -> Proc (26138.0) -
ブロックをコンテキストとともにオブジェクト化して返します。
...クを指定しない場合、Ruby 2.7 では
$VERBOSE = true のときには警告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生しま......ックがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo
pr = Proc.new
pr.call(1)
end
foo {|arg| p arg }
# => 1
//}
これは以下と同じです。
//emlist[例][ruby]{
def foo
yield(1)
end
foo {|arg| p arg }
# => 1
/......umentError が発生します。
//emlist[例][ruby]{
def foo
Proc.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}
Proc.new は、Proc#initialize が定義されていれば
オブジェクト... -
Proc
. new { . . . } -> Proc (26138.0) -
ブロックをコンテキストとともにオブジェクト化して返します。
...クを指定しない場合、Ruby 2.7 では
$VERBOSE = true のときには警告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生しま......ックがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo
pr = Proc.new
pr.call(1)
end
foo {|arg| p arg }
# => 1
//}
これは以下と同じです。
//emlist[例][ruby]{
def foo
yield(1)
end
foo {|arg| p arg }
# => 1
/......umentError が発生します。
//emlist[例][ruby]{
def foo
Proc.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}
Proc.new は、Proc#initialize が定義されていれば
オブジェクト... -
TracePoint
. new(*events) {|obj| . . . } -> TracePoint (26137.0) -
新しい TracePoint オブジェクトを作成して返します。トレースを有効 にするには TracePoint#enable を実行してください。
...場合][ruby]{
trace = TracePoint.new(:call) do |tp|
p [tp.lineno, tp.defined_class, tp.method_id, tp.event]
end
# => #<TracePoint:0x007f17372cdb20>
trace.enable
# => false
puts "Hello, TracePoint!"
# ...
# [69, IRB::Notifier::AbstractNotifier, :printf, :call]
# ...
//}
トレースを無効......定義、特異クラス定義、モジュール定義の終了。
: :call
Ruby で記述されたメソッドの呼び出し。
: :return
Ruby で記述されたメソッド呼び出しからのリターン。
: :c_call
C で記述されたメソッドの呼び出し。
: :c_return......C で記述されたメソッド呼び出しからのリターン。
: :raise
例外の発生。
: :b_call
ブロックの開始。
: :b_return
ブロックの終了。
: :thread_begin
スレッドの開始。
: :thread_end
スレッドの終了。
指定イベントに関連......C で記述されたメソッド呼び出しからのリターン。
: :raise
例外の発生。
: :b_call
ブロックの開始。
: :b_return
ブロックの終了。
: :thread_begin
スレッドの開始。
: :thread_end
スレッドの終了。
: :fiber_switch
ファイ... -
Proc
. new { . . . } -> Proc (26131.0) -
ブロックをコンテキストとともにオブジェクト化して返します。
...を行ったときに発生します。
//emlist[][ruby]{
pr = Proc.new {|arg| p arg }
pr.call(1) # => 1
//}
//emlist[][ruby]{
Proc.new # => -e:1:in `new': tried to create Proc object without a block (ArgumentError)
//}
Proc.new は、Proc#initialize が定義されていれば
オブジェクト... -
Method
# call(*args) -> object (23120.0) -
メソッドオブジェクトに封入されているメソッドを起動します。
...f に渡される引数。
@see UnboundMethod#bind_call
@see spec/safelevel
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}......@param args self に渡される引数。
@see UnboundMethod#bind_call
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}... -
Method
# call(*args) { . . . } -> object (23120.0) -
メソッドオブジェクトに封入されているメソッドを起動します。
...f に渡される引数。
@see UnboundMethod#bind_call
@see spec/safelevel
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}......@param args self に渡される引数。
@see UnboundMethod#bind_call
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}... -
Method
# call(*args) -> object (23114.0) -
メソッドオブジェクトに封入されているメソッドを起動します。
...せん。
@param args self に渡される引数。
@see spec/safelevel
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}... -
Method
# call(*args) { . . . } -> object (23114.0) -
メソッドオブジェクトに封入されているメソッドを起動します。
...せん。
@param args self に渡される引数。
@see spec/safelevel
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}... -
UnboundMethod
# bind _ call(recv , *args) -> object (14126.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 (14126.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... -
TracePoint
# callee _ id -> Symbol | nil (14118.0) -
イベントが発生したメソッドの呼ばれた名前を Symbol で返します。 トップレベルであった場合は nil を返します。
...した場合に発生します。
//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]
end
trace.enable do
C.new.alias_name
end
//}
@see TracePoint#method_id...