るりまサーチ (Ruby 2.7.0)

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.043秒)
トップページ > クエリ:Class[x] > バージョン:2.7.0[x] > クエリ:to_s[x] > モジュール:Kernel[x]

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

種類

ライブラリ

キーワード

検索結果

Kernel.#set_trace_func(proc) -> Proc (238.0)

Ruby インタプリタのイベントをトレースする Proc オブジェクトとして 指定された proc を登録します。 nil を指定するとトレースがオフになります。

...uby]{
set_trace_func lambda {|*arg|
p arg
}
class Foo
end
43.to_s

# ----結果----
# ["c-return", "..", 1, :set_trace_func, #<Binding:0xf6ceb8>, Kernel]
# ["line", "..", 4, nil, #<Binding:0x10cbcd8>, nil]
# ["c-call", "..", 4, :inherited, #<Binding:0x10cba98>, Class]
# ["c-return", "..", 4, :inhe...
...["class", "..", 4, nil, #<Binding:0x10cb600>, nil]
# ["end", "..", 5, nil, #<Binding:0x10cb3f0>, nil]
# ["line", "..", 6, nil, #<Binding:0x10cb1e0>, nil]
# ["c-call", "..", 6, :to_s, #<Binding:0x10cafd0>, Fixnum]
# ["c-return", "..", 6, :to_s, #<Binding:0x10cad78>, Fixnum]
//}

@see Kernel.#caller...

Kernel.#String(arg) -> String (94.0)

引数を文字列(String)に変換した結果を返します。

引数を文字列(String)に変換した結果を返します。

arg.to_s を呼び出して文字列に変換します。
arg が文字列の場合、何もせず arg を返します。

@param arg 変換対象のオブジェクトです。
@raise TypeError to_s の返り値が文字列でなければ発生します。

//emlist[例][ruby]{
class Foo
def to_s
"hogehoge"
end
end

arg = Foo.new
p String(arg) #=> "hogehoge"
//}

@see Object#to_s,String

Kernel$$ERROR_INFO -> Exception | nil (40.0)

$! の別名

$! の別名

require "English"
class SomethingError < StandardError; end

begin
raise SomethingError
rescue
p $ERROR_INFO.backtrace #=> ["sample.rb:5"]
p $ERROR_INFO.to_s #=> "SomethingError"
end