ライブラリ
- ビルトイン (1187)
-
minitest
/ spec (1) - psych (8)
- rake (13)
キーワード
- < (13)
- <= (13)
- <=> (13)
- === (13)
- > (13)
- >= (13)
-
alias
_ method (13) - ancestors (13)
-
append
_ features (13) - attr (39)
-
attr
_ accessor (13) -
attr
_ reader (13) -
attr
_ writer (13) - autoload (13)
- autoload? (13)
-
class
_ eval (26) -
class
_ exec (13) -
class
_ variable _ defined? (13) -
class
_ variable _ get (13) -
class
_ variable _ set (13) -
class
_ variables (13) -
const
_ added (4) -
const
_ defined? (13) -
const
_ get (13) -
const
_ missing (13) -
const
_ set (13) -
const
_ source _ location (13) - constants (13)
-
define
_ method (26) -
deprecate
_ constant (13) -
extend
_ object (13) - extended (13)
- freeze (13)
- include (13)
- include? (13)
- included (13)
-
included
_ modules (13) -
infect
_ with _ assertions (1) - inspect (13)
-
instance
_ method (13) -
instance
_ methods (13) -
method
_ added (13) -
method
_ defined? (13) -
method
_ removed (13) -
method
_ undefined (13) -
module
_ eval (26) -
module
_ exec (13) -
module
_ function (39) - name (13)
- prepend (13)
-
prepend
_ features (13) - prepended (13)
- private (52)
-
private
_ class _ method (26) -
private
_ constant (13) -
private
_ instance _ methods (13) -
private
_ method _ defined? (13) - protected (52)
-
protected
_ instance _ methods (13) -
protected
_ method _ defined? (13) -
psych
_ yaml _ as (4) - public (52)
-
public
_ class _ method (26) -
public
_ constant (13) -
public
_ instance _ method (13) -
public
_ instance _ methods (13) -
public
_ method _ defined? (13) -
rake
_ extension (13) - refine (13)
-
remove
_ class _ variable (13) -
remove
_ const (13) -
remove
_ method (13) -
ruby2
_ keywords (13) -
singleton
_ class? (13) -
to
_ s (13) -
undef
_ method (13) - using (13)
-
yaml
_ as (4)
検索結果
先頭5件
-
Module
# <(other) -> bool | nil (2.0) -
比較演算子。self が other の子孫である場合、 true を返します。 self が other の先祖か同一のクラス/モジュールである場合、false を返します。
...list[例][ruby]{
module Foo
end
class Bar
include Foo
end
class Baz < Bar
end
class Qux
end
p Bar < Foo # => true
p Baz < Bar # => true
p Baz < Foo # => true
p Baz < Qux # => nil
p Baz > Qux # => nil
p Foo < Object.new # => in `<': compared with non class/module (TypeError)
//}......list[例][ruby]{
module Foo
end
class Bar
include Foo
end
class Baz < Bar
end
class Qux
end
p Bar < Foo # => true
p Baz < Bar # => true
p Baz < Foo # => true
p Baz < Qux # => nil
p Baz > Qux # => nil
p Foo < Object.new # => in '<': compared with non class/module (TypeError)
//}... -
Module
# <=(other) -> bool | nil (2.0) -
比較演算子。self が other の子孫であるか、self と other が 同一クラスである場合、 true を返します。 self が other の先祖である場合、false を返します。
...クラス
@raise TypeError other がクラスやモジュールではない場合に発生します。
@see Module#<
//emlist[例][ruby]{
module Foo; end
module Bar
include Foo
end
module Baz
prepend Foo
end
Bar.ancestors # => [Bar, Foo]
Foo <= Bar # => false
Bar <= Foo # => true
Baz.ancest... -
Module
# <=>(other) -> Integer | nil (2.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 # =>... -
Module
# ===(obj) -> bool (2.0) -
指定された obj が self かそのサブクラスのインスタンスであるとき真を返します。 また、obj が self をインクルードしたクラスかそのサブクラスのインスタンスである場合にも 真を返します。上記のいずれでもない場合に false を返します。
指定された obj が self かそのサブクラスのインスタンスであるとき真を返します。
また、obj が self をインクルードしたクラスかそのサブクラスのインスタンスである場合にも
真を返します。上記のいずれでもない場合に false を返します。
言い替えると obj.kind_of?(self) が true の場合、 true を返します。
このメソッドは主に case 文での比較に用いられます。
case ではクラス、モジュールの所属関係をチェックすることになります。
//emlist[例][ruby]{
str = String.new
case str
when St... -
Module
# >(other) -> bool | nil (2.0) -
比較演算子。 self が other の先祖である場合、true を返します。 self が other の子孫か同一クラスである場合、false を返します。
...@raise TypeError other がクラスやモジュールではない場合に発生します。
@see Module#<
//emlist[例][ruby]{
module Awesome; end
module Included
include Awesome
end
module Prepended
prepend Awesome
end
Included.ancestors # => [Included, Awesome]
Awesome > Included # => tr... -
Module
# >=(other) -> bool | nil (2.0) -
比較演算子。self が other の先祖か同一クラスである場合、 true を返します。 self が other の子孫である場合、false を返します。
...クラス
@raise TypeError other がクラスやモジュールではない場合に発生します。
@see Module#<
//emlist[例][ruby]{
module Foo; end
module Bar
include Foo
end
module Baz
prepend Foo
end
Bar.ancestors # => [Bar, Foo]
Foo >= Bar # => true
Bar >= Foo # => false
Baz.ancest... -
Module
# alias _ method(new , original) -> Symbol (2.0) -
メソッドの別名を定義します。
...メソッドの別名を定義します。
//emlist[例][ruby]{
module Kernel
alias_method :hoge, :puts # => :hoge
alias_method "foo", :puts # => :foo
end
//}
alias との違いは以下の通りです。
* メソッド名は String または Symbol で指定します
* グローバル......ます。
@param original 元のメソッド名。String または Symbol で指定します。
@return 作成したエイリアスのメソッド名を表す Symbol を返します。
@see d:spec/def#alias
//emlist[例][ruby]{
module Kernel
alias_method :foo, :puts
end
foo "bar" # bar
//}... -
Module
# alias _ method(new , original) -> self (2.0) -
メソッドの別名を定義します。
...メソッドの別名を定義します。
//emlist[例][ruby]{
module Kernel
alias_method :hoge, :puts # => Kernel
end
//}
alias との違いは以下の通りです。
* メソッド名は String または Symbol で指定します
* グローバル変数の別名をつけることはで......いメソッド名。String または Symbol で指定します。
@param original 元のメソッド名。String または Symbol で指定します。
@return self を返します。
@see d:spec/def#alias
//emlist[例][ruby]{
module Kernel
alias_method :foo, :puts
end
foo "bar" # bar
//}... -
Module
# ancestors -> [Class , Module] (2.0) -
クラス、モジュールのスーパークラスとインクルードしているモジュール を優先順位順に配列に格納して返します。
...先順位順に配列に格納して返します。
//emlist[例][ruby]{
module Foo
end
class Bar
include Foo
end
class Baz < Bar
p ancestors
p included_modules
p superclass
end
# => [Baz, Bar, Foo, Object, Kernel, BasicObject]
# => [Foo, Kernel]
# => Bar
//}
@see Module#included_modules...
