種類
- インスタンスメソッド (907)
- 特異メソッド (52)
ライブラリ
- ビルトイン (939)
-
minitest
/ spec (1) - psych (8)
- rake (11)
キーワード
- < (11)
- <= (11)
- <=> (11)
- === (11)
- >= (11)
-
alias
_ method (11) - ancestors (11)
-
append
_ features (11) - attr (33)
-
attr
_ accessor (11) -
attr
_ reader (11) -
attr
_ writer (11) - autoload (11)
- autoload? (11)
-
class
_ eval (22) -
class
_ exec (11) -
class
_ variable _ defined? (11) -
class
_ variable _ get (11) -
class
_ variable _ set (11) -
class
_ variables (11) -
const
_ added (2) -
const
_ defined? (11) -
const
_ get (11) -
const
_ set (11) -
const
_ source _ location (5) - constants (22)
-
define
_ method (22) -
deprecate
_ constant (9) -
extend
_ object (11) - extended (11)
- freeze (11)
- include (11)
- include? (11)
- included (11)
-
included
_ modules (11) -
infect
_ with _ assertions (1) - inspect (11)
-
instance
_ method (11) -
instance
_ methods (11) -
method
_ added (11) -
method
_ defined? (11) -
method
_ removed (11) -
method
_ undefined (11) -
module
_ eval (22) -
module
_ exec (11) -
module
_ function (19) - name (11)
- nesting (11)
- new (22)
- prepend (11)
-
prepend
_ features (11) - prepended (11)
- private (23)
-
private
_ class _ method (15) -
private
_ constant (11) -
private
_ instance _ methods (11) -
private
_ method _ defined? (11) - protected (23)
-
protected
_ instance _ methods (11) -
protected
_ method _ defined? (11) -
psych
_ yaml _ as (4) - public (23)
-
public
_ class _ method (15) -
public
_ constant (11) -
public
_ instance _ method (11) -
public
_ instance _ methods (11) -
public
_ method _ defined? (11) -
rake
_ extension (11) - refine (11)
-
remove
_ class _ variable (11) -
remove
_ const (11) -
remove
_ method (11) -
ruby2
_ keywords (5) -
singleton
_ class? (11) -
to
_ s (11) -
undef
_ method (11) -
used
_ modules (8) - using (11)
-
yaml
_ as (4)
検索結果
先頭5件
-
Module
# >(other) -> bool | nil (21337.0) -
比較演算子。 self が other の先祖である場合、true を返します。 self が other の子孫か同一クラスである場合、false を返します。
...比較演算子。 self が other の先祖である場合、true を返します。
self が other の子孫か同一クラスである場合、false を返します。
継承関係にないクラス同士の比較では
nil を返します。
@param other 比較対象のモジュールやクラ......@see Module#<
//emlist[例][ruby]{
module Awesome; end
module Included
include Awesome
end
module Prepended
prepend Awesome
end
Included.ancestors # => [Included, Awesome]
Awesome > Included # => true
Included > Awesome # => false
Prepended.ancestors # => [Awesome, Prepended]
Awesome > Prep......ended # => true
Prepended > Awesome # => false
Awesome > Awesome # => false
Awesome > Object # => nil
//}... -
Module
# >=(other) -> bool | nil (9301.0) -
比較演算子。self が other の先祖か同一クラスである場合、 true を返します。 self が other の子孫である場合、false を返します。
...比較演算子。self が other の先祖か同一クラスである場合、 true を返します。
self が other の子孫である場合、false を返します。
継承関係にないクラス同士の比較では
nil を返します。
@param other 比較対象のモジュールやクラ......e 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.ancestors # => [Foo, Baz]
Foo >= Baz # => true
Baz >= Foo # => false
Foo >= Foo # => true
Foo >= Object # => nil... -
Module
. used _ modules -> [Module] (9301.0) -
現在のスコープで using されているすべてのモジュールを配列で返します。 配列内のモジュールの順番は未定義です。
...ープで using されているすべてのモジュールを配列で返します。
配列内のモジュールの順番は未定義です。
//emlist[例][ruby]{
module A
refine Object do
end
end
module B
refine Object do
end
end
using A
using B
p Module.used_modules
#=> [B, A]
//}... -
Module
# <=>(other) -> Integer | nil (9201.0) -
self と other の継承関係を比較します。
...elf と other の継承関係を比較します。
self と other を比較して、
self が other の子孫であるとき -1、
同一のクラス/モジュールのとき 0、
self が other の先祖であるとき 1
を返します。
継承関係にないクラス同士の比較では
nil......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 <=> Baz......# => nil
p Baz <=> Object.new # => nil
//}... -
Module
# class _ variable _ defined?(name) -> bool (9201.0) -
name で与えられた名前のクラス変数がモジュールに存在する場合 true を 返します。
...name Symbol か String を指定します。
//emlist[例][ruby]{
class Fred
@@foo = 99
end
Fred.class_variable_defined?(:@@foo) #=> true
Fred.class_variable_defined?(:@@bar) #=> false
Fred.class_variable_defined?('@@foo') #=> true
Fred.class_variable_defined?('@@bar') #=> false
//}... -
Module
# class _ variable _ get(name) -> object (9201.0) -
クラス/モジュールに定義されているクラス変数 name の値を返します。
...の値を返します。
@param name String または Symbol を指定します。
@raise NameError クラス変数 name が定義されていない場合、発生します。
//emlist[例][ruby]{
class Fred
@@foo = 99
end
def Fred.foo
class_variable_get(:@@foo)
end
p Fred.foo #=> 99
//}... -
Module
# class _ variable _ set(name , val) -> object (9201.0) -
クラス/モジュールにクラス変数 name を定義して、その値として val をセットします。val を返します。
...val をセットします。val を返します。
@param name String または Symbol を指定します。
//emlist[例][ruby]{
class Fred
@@foo = 99
def foo
@@foo
end
end
def Fred.foo(val)
class_variable_set(:@@foo, val)
end
p Fred.foo(101) # => 101
p Fred.new.foo # => 101
/... -
Module
# class _ variables(inherit = true) -> [Symbol] (9201.0) -
クラス/モジュールに定義されているクラス変数の名前の配列を返します。
...rit false を指定しない場合はスーパークラスやインクルードして
いるモジュールのクラス変数を含みます。
//emlist[例][ruby]{
class One
@@var1 = 1
end
class Two < One
@@var2 = 2
end
One.class_variables # => [:@@var1]
Two.class_variables......# => [:@@var2, :@@var1]
Two.class_variables(false) # => [:@@var2]
//}
@see Module.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#constants... -
Module
# included _ modules -> [Module] (9201.0) -
self にインクルードされているモジュールの配列を返します。
...self にインクルードされているモジュールの配列を返します。
//emlist[例][ruby]{
module Mixin
end
module Outer
include Mixin
end
Mixin.included_modules #=> []
Outer.included_modules #=> [Mixin]
//}
@see Module#ancestors... -
Module
# module _ function() -> nil (9201.0) -
メソッドをモジュール関数にします。
...引数が与えられた時には配列にまとめて返します。
引数なしの時は nil を返します。
@param name String または Symbol を 0 個以上指定します。
=== 注意
module_function はメソッドに「モジュール関数」という属性をつけるメ
ソッド......もモジュール関数の別名は定義できません。
//emlist[例][ruby]{
module M
def foo
p "foo"
end
module_function :foo
alias bar foo
end
M.foo # => "foo"
M.bar # => undefined method `bar' for Foo:Module (NoMethodError)
//}
このコードでは、モジュール関数......けるには、
以下のように、先に別名を定義してから
それぞれをモジュール関数にしなければいけません。
//emlist[例][ruby]{
module M
def foo
p "foo"
end
alias bar foo
module_function :foo, :bar
end
M.foo # => "foo"
M.bar # => "foo"
//}...