るりまサーチ

最速Rubyリファレンスマニュアル検索!
26件ヒット [1-26件を表示] (0.031秒)
トップページ > クラス:Method[x] > クエリ:to_s[x]

別のキーワード

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

ライブラリ

検索結果

Method#to_s -> String (15102.0)

self を読みやすい文字列として返します。

...以下の形式の文字列を返します。

```text
#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)
```

klass1 は、[m:Method#inspect] では、レシーバのクラス名、
[m:UnboundMethod#inspect] では、[c:UnboundMethod] オブジェクトの生成元となったクラス/...
...klass2 は、実際にそのメソッドを定義しているクラス/モジュール名、
method
は、メソッド名を表します。

arg は引数を表します。
「foo.rb:2」は [m:Method#source_location] を表します。
source_location が nil の場合には付きません。...
...bar(a, b)
end
end

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
```

klass1 と klass2 が同じ場合は以下の形式になります。

```text
#<Method: klass1#method() foo.rb:2> (形...

Method#inspect -> String (2.0)

self を読みやすい文字列として返します。

...以下の形式の文字列を返します。

```text
#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)
```

klass1 は、[m:Method#inspect] では、レシーバのクラス名、
[m:UnboundMethod#inspect] では、[c:UnboundMethod] オブジェクトの生成元となったクラス/...
...klass2 は、実際にそのメソッドを定義しているクラス/モジュール名、
method
は、メソッド名を表します。

arg は引数を表します。
「foo.rb:2」は [m:Method#source_location] を表します。
source_location が nil の場合には付きません。...
...bar(a, b)
end
end

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
```

klass1 と klass2 が同じ場合は以下の形式になります。

```text
#<Method: klass1#method() foo.rb:2> (形...