種類
- インスタンスメソッド (1357)
- 特異メソッド (199)
- モジュール関数 (77)
- クラス (55)
クラス
- BasicObject (66)
- Class (22)
-
Enumerator
:: Lazy (55) - Hash (5)
- Method (33)
- Module (950)
- Object (220)
- Proc (16)
- Refinement (3)
- SystemCallError (11)
- TracePoint (11)
- UnboundMethod (22)
モジュール
- Enumerable (44)
- Kernel (55)
- Marshal (22)
- Warning (8)
オブジェクト
- main (90)
キーワード
- < (11)
- <= (11)
- <=> (11)
- === (33)
- > (11)
- >= (11)
- Class (11)
- DomainError (11)
- Enumerator (11)
- UnboundMethod (11)
-
alias
_ method (11) - ancestors (11)
-
append
_ features (11) - attr (33)
-
attr
_ accessor (11) -
attr
_ reader (11) -
attr
_ writer (11) - autoload (22)
- autoload? (11)
- bind (11)
- class (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
_ missing (11) -
const
_ set (11) -
const
_ source _ location (5) - constants (22)
-
define
_ method (44) -
defined
_ class (11) -
deprecate
_ constant (9) - dump (22)
-
enum
_ for (44) - eval (22)
- extend (11)
-
extend
_ object (11) - extended (11)
- freeze (11)
-
global
_ variables (11) -
import
_ methods (3) - include (22)
- include? (11)
- included (11)
-
included
_ modules (11) - inspect (22)
-
instance
_ eval (22) -
instance
_ exec (11) -
instance
_ method (11) -
instance
_ methods (11) -
instance
_ variables (11) -
is
_ a? (11) -
kind
_ of? (11) - lambda? (11)
-
local
_ variables (11) -
max
_ by (44) - method (11)
-
method
_ added (11) -
method
_ defined? (11) -
method
_ removed (11) -
method
_ undefined (11) - methods (11)
-
module
_ eval (22) -
module
_ exec (11) -
module
_ function (19) - name (11)
- nesting (11)
- new (55)
- owner (22)
- prepend (11)
-
prepend
_ features (11) - prepended (11)
- private (46)
-
private
_ class _ method (15) -
private
_ constant (11) -
private
_ instance _ methods (11) -
private
_ method _ defined? (11) -
private
_ methods (11) - protected (23)
-
protected
_ instance _ methods (11) -
protected
_ method _ defined? (11) -
protected
_ methods (11) - public (46)
-
public
_ class _ method (15) -
public
_ constant (11) -
public
_ instance _ method (11) -
public
_ instance _ methods (11) -
public
_ method (11) -
public
_ method _ defined? (11) -
public
_ methods (11) - refine (11)
-
remove
_ class _ variable (11) -
remove
_ const (11) -
remove
_ instance _ variable (11) -
remove
_ method (11) -
respond
_ to? (11) -
ruby2
_ keywords (10) -
ruby2
_ keywords _ hash? (5) -
singleton
_ class? (11) -
singleton
_ method (11) -
singleton
_ method _ added (11) -
singleton
_ method _ removed (11) -
singleton
_ method _ undefined (11) -
singleton
_ methods (11) -
to
_ enum (44) -
to
_ s (22) -
undef
_ method (11) -
used
_ modules (8) - using (22)
- warn (8)
検索結果
先頭5件
-
Module
# constants(inherit = true) -> [Symbol] (29050.0) -
そのモジュール(またはクラス)で定義されている定数名の配列を返します。
...@see Module.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#class_variables
//emlist[Module.constants と Module#constants の違い][ruby]{
# 出力の簡略化のため起動時の定数一覧を取得して後で差し引く
$clist = Module.const......ない
p Module.constants - $clist # => [:BAR, :Bar, :Foo]
class Baz
# Baz は定数を含まない
p constants # => []
# ネストしたクラスでは、外側のクラスで定義した定数は
# 参照可能なので、BAR は、Module.constant......s には含まれる
# (クラス Baz も Bar の定数なので同様)
p Module.constants - $clist # => [:BAR, :Baz, :Foo, :Bar]
end
end
//}... -
Module
# include(*mod) -> self (29038.0) -
モジュール mod をインクルードします。
...ます。
@param mod Module のインスタンス( Enumerable など)を指定します。
@raise ArgumentError 継承関係が循環してしまうような include を行った場合に発生します。
//emlist[例][ruby]{
module M
end
module M2
include M
end
module M
include M2
end
//}......ールのほうが
先に行われます
(上の例の Module#ancestors の結果がメソッド探索の順序です)。
同じモジュールを二回以上 include すると二回目以降は無視されます。
//emlist[例][ruby]{
module M
end
class C1
include M
end
class C2 < C1
include... -
Module
# prepend _ features(mod) -> self (29036.0) -
Module#prepend から呼び出されるメソッドで、 prepend の処理の実体です。このメソッド自体は mod で指定した モジュール/クラスの継承チェインの先頭に self を追加します。
...Module#prepend から呼び出されるメソッドで、
prepend の処理の実体です。このメソッド自体は mod で指定した
モジュール/クラスの継承チェインの先頭に self を追加します。
このメソッドを上書きすることで、prepend の処理を変......れます
//emlist[例][ruby]{
class Recorder
RECORDS = []
end
module X
def self.prepend_features(mod)
Recorder::RECORDS << mod
end
end
class A
prepend X
end
class B
include X
end
class C
prepend X
end
Recorder::RECORDS # => [A, C]
//}
@see Module#prepend, Module#prepended... -
Module
# inspect -> String (29032.0) -
モジュールやクラスの名前を文字列で返します。
...t[例][ruby]{
module A
module B
end
p B.name #=> "A::B"
class C
end
end
p A.name #=> "A"
p A::B.name #=> "A::B"
p A::C.name #=> "A::C"
# 名前のないモジュール / クラス
p Module.new.name #=> nil
p Class.new.name #=> nil
p Module.new.to_s #=> "#<Module:0x00007f90b0... -
Module
# name -> String | nil (29032.0) -
モジュールやクラスの名前を文字列で返します。
...t[例][ruby]{
module A
module B
end
p B.name #=> "A::B"
class C
end
end
p A.name #=> "A"
p A::B.name #=> "A::B"
p A::C.name #=> "A::C"
# 名前のないモジュール / クラス
p Module.new.name #=> nil
p Class.new.name #=> nil
p Module.new.to_s #=> "#<Module:0x00007f90b0... -
Module
# to _ s -> String (29032.0) -
モジュールやクラスの名前を文字列で返します。
...t[例][ruby]{
module A
module B
end
p B.name #=> "A::B"
class C
end
end
p A.name #=> "A"
p A::B.name #=> "A::B"
p A::C.name #=> "A::C"
# 名前のないモジュール / クラス
p Module.new.name #=> nil
p Class.new.name #=> nil
p Module.new.to_s #=> "#<Module:0x00007f90b0... -
Module
# <=(other) -> bool | nil (29026.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) -> bool | nil (29026.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 (29026.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
# method _ defined?(name) -> bool (29026.0) -
モジュールにインスタンスメソッド name が定義されており、 かつその可視性が public または protected であるときに true を返します。
...に
true を返します。
@param name Symbol か String を指定します。
@see Module#public_method_defined?, Module#private_method_defined?, Module#protected_method_defined?
//emlist[例][ruby]{
module A
def method1() end
def protected_method1() end
protected :protected_method1
end... -
Module
# method _ defined?(name , inherit=true) -> bool (29026.0) -
モジュールにインスタンスメソッド name が定義されており、 かつその可視性が public または protected であるときに true を返します。
...モジュールで
定義されたメソッドも対象になります。
@see Module#public_method_defined?, Module#private_method_defined?, Module#protected_method_defined?
//emlist[例][ruby]{
module A
def method1() end
def protected_method1() end
protected :protected_method1
end...