るりまサーチ

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

別のキーワード

  1. module attr
  2. module public
  3. module private
  4. module protected
  5. module module_eval

ライブラリ

クラス

検索結果

Method#inspect -> String (18144.0)

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

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

#<Method: klass1(klass2)#method> (形式1)

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。

klass2...
...定義しているクラス/モジュール名、
method は、メソッド名を表します。

//emlist[例][ruby]{
module
Foo
def foo
"foo"
end
end
class Bar
include
Foo
def bar
end
end

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo>
p Bar.new.method(:bar) # =>...
...# スーパークラスのクラスメソッド
class Bar < Foo
end
p Bar.method(:foo) # => #<Method: Bar.foo>

# 以下は(形式1)の出力になる
module
Baz
def baz
end
end

class <<obj
include
Baz
end
p obj.method(:baz) # => #<Method: Object(Baz)#baz>
//}

@see Object#inspect...
...の文字列を返します。

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

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。

klass2...
...ethod#source_location を表します。
source_location が nil の場合には付きません。

//emlist[例][ruby]{
module
Foo
def foo
"foo"
end
end
class Bar
include
Foo
def bar(a, b)
end
end

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method...
...ラスメソッド
class Bar < Foo
end
p Bar.method(:foo) # => #<Method: Bar(Foo).foo() foo.rb:11>

# 以下は(形式1)の出力になる
module
Baz
def baz
end
end

class <<obj
include
Baz
end
p obj.method(:baz) # => #<Method: String(Baz)#baz() foo.rb:23>
//}

@see Object#inspect...

Method#to_s -> String (3044.0)

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

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

#<Method: klass1(klass2)#method> (形式1)

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。

klass2...
...定義しているクラス/モジュール名、
method は、メソッド名を表します。

//emlist[例][ruby]{
module
Foo
def foo
"foo"
end
end
class Bar
include
Foo
def bar
end
end

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo>
p Bar.new.method(:bar) # =>...
...# スーパークラスのクラスメソッド
class Bar < Foo
end
p Bar.method(:foo) # => #<Method: Bar.foo>

# 以下は(形式1)の出力になる
module
Baz
def baz
end
end

class <<obj
include
Baz
end
p obj.method(:baz) # => #<Method: Object(Baz)#baz>
//}

@see Object#inspect...
...の文字列を返します。

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

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。

klass2...
...ethod#source_location を表します。
source_location が nil の場合には付きません。

//emlist[例][ruby]{
module
Foo
def foo
"foo"
end
end
class Bar
include
Foo
def bar(a, b)
end
end

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method...
...ラスメソッド
class Bar < Foo
end
p Bar.method(:foo) # => #<Method: Bar(Foo).foo() foo.rb:11>

# 以下は(形式1)の出力になる
module
Baz
def baz
end
end

class <<obj
include
Baz
end
p obj.method(:baz) # => #<Method: String(Baz)#baz() foo.rb:23>
//}

@see Object#inspect...