種類
ライブラリ
- ビルトイン (1966)
- drb (12)
- erb (12)
-
fiddle
/ import (84) - forwardable (24)
-
irb
/ context (12) -
minitest
/ spec (1) -
minitest
/ unit (1) - monitor (12)
-
mutex
_ m (36) - objspace (12)
- profiler (6)
- psych (8)
- rake (12)
-
rdoc
/ class _ module (12) -
rdoc
/ code _ object (12) -
rdoc
/ context (108) -
rdoc
/ normal _ module (12) -
rdoc
/ stats (24) -
rdoc
/ top _ level (48) - win32ole (36)
クラス
- BasicObject (72)
- Class (24)
- ERB (12)
-
Enumerator
:: Lazy (60) - Hash (6)
-
IRB
:: Context (12) - Method (36)
- Module (1176)
- Object (240)
- Proc (18)
-
RDoc
:: CodeObject (12) -
RDoc
:: Context (108) -
RDoc
:: Stats (24) -
RDoc
:: TopLevel (48) - Refinement (4)
- SystemCallError (12)
- TracePoint (12)
- UnboundMethod (24)
- WIN32OLE (12)
-
WIN32OLE
_ TYPE (24)
モジュール
- Enumerable (48)
-
Fiddle
:: Importer (84) - Kernel (60)
- Marshal (24)
-
MiniTest
:: Assertions (1) -
Mutex
_ m (24) - ObjectSpace (12)
- Warning (9)
オブジェクト
- main (102)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - < (12)
- <= (12)
- <=> (12)
- === (36)
- > (12)
- >= (12)
- Class (12)
- ClassModule (12)
- DRbProtocol (12)
- DomainError (12)
- Enumerator (12)
- Forwardable (12)
- Marshal フォーマット (12)
- Module (12)
- MonitorMixin (12)
-
Mutex
_ m (12) -
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 1 . 0 (12) -
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 2
. 6 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) - NormalModule (12)
-
Profiler
_ _ (6) - RMODULE (12)
- Ruby プログラムの実行 (12)
- Ruby用語集 (12)
- SingleForwardable (12)
- UnboundMethod (12)
-
add
_ class _ or _ module (24) -
add
_ module (12) -
alias
_ method (12) -
all
_ classes _ and _ modules (12) - ancestors (12)
-
append
_ features (24) -
assert
_ instance _ of (1) - attr (36)
-
attr
_ accessor (12) -
attr
_ reader (12) -
attr
_ writer (12) - autoload (24)
- autoload? (12)
- bind (24)
-
boot
_ defclass (12) - class (12)
-
class
_ eval (24) -
class
_ exec (12) -
class
_ variable _ defined? (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) -
class
_ variables (12) -
const
_ added (3) -
const
_ defined? (12) -
const
_ get (12) -
const
_ load (12) -
const
_ missing (12) -
const
_ set (12) -
const
_ source _ location (12) - constants (24)
-
count
_ objects _ size (12) -
create
_ value (12) - debug (12)
-
def
_ module (12) -
default
_ event _ sources (12) -
define
_ method (48) -
defined
_ class (12) -
deprecate
_ constant (12) - drb (12)
- dump (24)
- e2mmap (6)
-
each
_ classmodule (12) -
enum
_ for (48) - eval (24)
- extend (12)
-
extend
_ object (24) - extended (12)
- extern (12)
- fiddle (12)
-
fiddle
/ import (12) -
fiddle
/ types (12) -
find
_ enclosing _ module _ named (12) -
find
_ local _ symbol (24) -
find
_ module _ named (24) -
find
_ symbol (12) - freeze (12)
-
global
_ variables (12) -
import
_ methods (4) - include (24)
- include? (12)
-
include
_ class _ new (12) - included (12)
-
included
_ modules (12) -
infect
_ with _ assertions (1) -
initialize
_ classes _ and _ modules (12) - inspect (24)
-
instance
_ eval (24) -
instance
_ exec (12) -
instance
_ method (12) -
instance
_ methods (12) -
instance
_ variables (12) -
is
_ a? (12) -
kind
_ of? (12) - lambda? (12)
-
load
_ modules (12) -
local
_ variables (12) -
max
_ by (48) - method (12)
-
method
_ added (12) -
method
_ defined? (12) -
method
_ removed (12) -
method
_ undefined (12) - methods (12)
-
module
_ eval (24) -
module
_ exec (12) -
module
_ function (36) -
module
_ setup (12) - modules (12)
- name (12)
- nesting (12)
- new (60)
-
num
_ modules (12) -
num
_ modules= (12) -
ole
_ type (12) -
original
_ module (12) - owner (24)
- prepend (12)
-
prepend
_ features (12) - prepended (12)
- private (75)
-
private
_ class _ method (24) -
private
_ constant (12) -
private
_ instance _ methods (12) -
private
_ method _ defined? (12) -
private
_ methods (12) - protected (48)
-
protected
_ instance _ methods (12) -
protected
_ method _ defined? (12) -
protected
_ methods (12) -
psych
_ yaml _ as (4) - public (75)
-
public
_ class _ method (24) -
public
_ constant (12) -
public
_ instance _ method (12) -
public
_ instance _ methods (12) -
public
_ method (12) -
public
_ method _ defined? (12) -
public
_ methods (12) - rake (12)
-
rake
_ extension (12) -
rb
_ class _ instance _ methods (12) -
rb
_ class _ path (12) -
rb
_ class _ private _ instance _ methods (12) -
rb
_ class _ protected _ instance _ methods (12) -
rb
_ define _ module (12) -
rb
_ define _ module _ function (12) -
rb
_ define _ module _ id (12) -
rb
_ define _ module _ under (12) -
rb
_ extend _ object (12) -
rb
_ include _ module (12) -
rb
_ mod _ append _ features (12) -
rb
_ mod _ include (12) -
rb
_ mod _ included _ modules (12) -
rb
_ mod _ initialize (12) -
rb
_ mod _ modfunc (12) -
rb
_ mod _ module _ eval (12) -
rb
_ mod _ name (12) -
rb
_ mod _ private (12) -
rb
_ mod _ protected (12) -
rb
_ mod _ public (12) -
rb
_ mod _ remove _ method (12) -
rb
_ module _ new (12) -
rb
_ module _ s _ alloc (12) - rdoc (12)
-
rdoc
/ class _ module (12) -
rdoc
/ normal _ module (12) - refine (12)
-
remove
_ class _ variable (12) -
remove
_ classes _ and _ modules (12) -
remove
_ const (12) -
remove
_ instance _ variable (12) -
remove
_ method (12) -
respond
_ to? (12) - rss (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) -
ruby2
_ keywords (18) -
ruby2
_ keywords _ hash? (6) -
singleton
_ class? (12) -
singleton
_ method (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12) -
singleton
_ methods (12) - sizeof (12)
-
specific
_ eval (12) - struct (12)
-
to
_ enum (48) -
to
_ s (24) -
undef
_ method (12) - union (12)
-
used
_ modules (12) - using (24)
- value (12)
- warn (9)
- xmlrpc (3)
- yaml (12)
-
yaml
_ as (4) - クラス/メソッドの定義 (12)
- 制御構造 (12)
- 変数と定数 (12)
- 字句構造 (12)
- 演算子式 (12)
検索結果
先頭5件
-
Module
# ancestors -> [Class , Module] (9113.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... -
Module
# append _ features(module _ or _ class) -> self (9113.0) -
モジュール(あるいはクラス)に self の機能を追加します。
...ラス)に self の機能を追加します。
このメソッドは Module#include の実体であり、
include を Ruby で書くと以下のように定義できます。
//emlist[例][ruby]{
def include(*modules)
modules.reverse_each do |mod|
# append_features や included はプライ......ベートメソッドなので
# 直接 mod.append_features(self) などとは書けない
mod.__send__(:append_features, self)
mod.__send__(:included, self)
end
end
//}
@see Module#included... -
Module
# using(module) -> self (9113.0) -
引数で指定したモジュールで定義された拡張を現在のクラス、モジュールで有 効にします。
...ルで有
効にします。
有効にした拡張の有効範囲については以下を参照してください。
* https://docs.ruby-lang.org/en/master/syntax/refinements_rdoc.html#label-Scope
@param module 有効にするモジュールを指定します。
@see Module#refine, main.using... -
Module
# constants(inherit = true) -> [Symbol] (9048.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 (9036.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 (9034.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 (9030.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 (9030.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 (9030.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...
