るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
4件ヒット [1-4件を表示] (0.049秒)
トップページ > バージョン:2.6.0[x] > クエリ:_builtin[x] > クエリ:nil[x] > クエリ:superclass[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

キーワード

検索結果

Class#superclass -> Class | nil (78751.0)

自身のスーパークラスを返します。

自身のスーパークラスを返します。

//emlist[例][ruby]{
File.superclass #=> IO
IO.superclass #=> Object
class Foo; end
class Bar < Foo; end
Bar.superclass #=> Foo
Object.superclass #=> BasicObject
//}

ただし BasicObject.superclass は nil を返します。

//emlist[例][ruby]{
BasicObject.supercl...

Class.new(superclass = Object) -> Class (24409.0)

新しく名前の付いていない superclass のサブクラスを生成します。

新しく名前の付いていない superclass のサブクラスを生成します。

名前のないクラスは、最初に名前を求める際に代入されている定数名を検
索し、見つかった定数名をクラス名とします。

//emlist[例][ruby]{
p foo = Class.new # => #<Class:0x401b90f8>
p foo.name # => nil
Foo = foo # ここで p foo すれば "Foo" 固定
Bar = foo
p foo.name # => "Bar" ("Foo" になるか "Bar" になるかは...

Class.new(superclass = Object) {|klass| ... } -> Class (24409.0)

新しく名前の付いていない superclass のサブクラスを生成します。

新しく名前の付いていない superclass のサブクラスを生成します。

名前のないクラスは、最初に名前を求める際に代入されている定数名を検
索し、見つかった定数名をクラス名とします。

//emlist[例][ruby]{
p foo = Class.new # => #<Class:0x401b90f8>
p foo.name # => nil
Foo = foo # ここで p foo すれば "Foo" 固定
Bar = foo
p foo.name # => "Bar" ("Foo" になるか "Bar" になるかは...

Method#super_method -> Method | nil (24340.0)

self 内で super を実行した際に実行されるメソッドを Method オブジェ クトにして返します。

self 内で super を実行した際に実行されるメソッドを Method オブジェ
クトにして返します。

@see UnboundMethod#super_method

//emlist[例][ruby]{
class Super
def foo
"superclass method"
end
end

class Sub < Super
def foo
"subclass method"
end
end

m = Sub.new.method(:foo) # => #<Method: Sub#foo>
m.call # => "subclass me...