るりまサーチ

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

別のキーワード

  1. openssl integer
  2. asn1 integer
  3. _builtin integer
  4. integer chr
  5. integer upto

ライブラリ

キーワード

検索結果

Module#<=>(other) -> Integer | nil (127.0)

self と other の継承関係を比較します。

...ければ
nil を返します。

@param other 比較対象のクラスやモジュール

//emlist[例][ruby]{
module
Foo
end

class Bar
include Foo
end

class Baz < Bar
end

class Qux
end

p Bar <=> Foo # => -1
p Baz <=> Bar # => -1
p Baz <=> Foo # => -1
p Baz <=> Qux # => nil
p Qux...

Module#const_source_location(name, inherited = true) -> [String, Integer] (127.0)

name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。

...][ruby]{
# test.rb:
class A # line 1
C1 = 1
C2 = 2
end


module
M # line 6
C3 = 3
end


class B < A # line 10
include M
C4 = 4
end


class A # 継続して A を定義する
C2 = 8 # 定数を再定義する
end


p B.const_source_location('C4') # => ["test.rb",...
...] -- Object を継承している為
p M.const_source_location('A') # => ["test.rb", 1] -- Object は継承していないが追加で modules をチェックする

p Object.const_source_location('A::C1') # => ["test.rb", 2] -- ネストの指定もサポートしている
p Object....