るりまサーチ

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

別のキーワード

  1. _builtin call
  2. fiddle call
  3. method call
  4. formatter call
  5. continuation call

モジュール

キーワード

検索結果

Thread::Backtrace::Location#inspect -> String (18121.0)

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 `initialize'"
# "path/to/foo.rb:9:in `new'"
# "path/to/foo.rb:9:in `<mai...

TracePoint#inspect -> String (18121.0)

self の状態を人間に読みやすい文字列にして返します。

...self の状態を人間に読みやすい文字列にして返します。

//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.inspect # "#<TracePoint:call `foo'@/path/to/test.rb:1>"
end
trace.enable
foo 1
//}...

UnboundMethod#bind_call(recv, *args) -> object (6128.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 (6128.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...

Hash#default_proc -> Proc | nil (14.0)

ハッシュのデフォルト値を返す 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 = Hash.new("default")
p h.default #=> "...

絞り込み条件を変える

Kernel.#abort -> () (14.0)

Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。

...ジ文字列です。

//emlist[][ruby]{
puts 'start'
begin
puts 'start1...'
abort "error1"
rescue SystemExit => err
puts "end1 with #{err.inspect}"
end

begin
puts 'start2...'
raise RuntimeError.new
rescue
abort
ensure
puts 'end2...'
end
puts 'end' #実行されない

#(標準出力)...
...#=> start
# start1...
# end1 with #<SystemExit: error1>
# start2...
# end2...
#終了ステータス:1
#(標準エラー出力)
#=> error1
# Traceback (most recent call last):
# sample.rb:11:in `<main>': RuntimeError (RuntimeError)
//}

@see Kernel.#exit,Kernel.#exit!...

Kernel.#abort(message) -> () (14.0)

Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。

...ジ文字列です。

//emlist[][ruby]{
puts 'start'
begin
puts 'start1...'
abort "error1"
rescue SystemExit => err
puts "end1 with #{err.inspect}"
end

begin
puts 'start2...'
raise RuntimeError.new
rescue
abort
ensure
puts 'end2...'
end
puts 'end' #実行されない

#(標準出力)...
...#=> start
# start1...
# end1 with #<SystemExit: error1>
# start2...
# end2...
#終了ステータス:1
#(標準エラー出力)
#=> error1
# Traceback (most recent call last):
# sample.rb:11:in `<main>': RuntimeError (RuntimeError)
//}

@see Kernel.#exit,Kernel.#exit!...