るりまサーチ

最速Rubyリファレンスマニュアル検索!
114件ヒット [1-100件を表示] (0.182秒)
トップページ > クエリ:-[x] > クエリ:E[x] > クエリ:d[x] > クエリ:included[x]

別のキーワード

  1. open3 popen2e
  2. socket af_e164
  3. open3 capture2e
  4. matrix det_e
  5. matrix rank_e

ライブラリ

クラス

モジュール

検索結果

<< 1 2 > >>

Module#included(class_or_module) -> () (30407.0)

self が Module#include されたときに対象のクラスまたはモジュー ルを引数にしてインタプリタがこのメソッドを呼び出します。

...self が Module#include されたときに対象のクラスまたはモジュー
ルを引数にしてインタプリタがこのメソッドを呼び出します。

@param class_or_module Module#include を実行したオブジェクト

//emlist[例][ruby]{
module Foo
d
ef self.included(mod)...
...p "#{mod} include #{self}"
e
nd
e
nd
class Bar
include Foo
e
nd
# => "Bar include Foo"
//}

@see Module#append_features...

Module#included_modules -> [Module] (21413.0)

self にインクルードされているモジュールの配列を返します。

...self にインクルードされているモジュールの配列を返します。

//emlist[例][ruby]{
module Mixin
e
nd

module Outer
include Mixin
e
nd

Mixin.included_modules #=> []
Outer.included_modules #=> [Mixin]
//}

@see Module#ancestors...

Module#append_features(module_or_class) -> self (12318.0)

モジュール(あるいはクラス)に self の機能を追加します。

...ラス)に self の機能を追加します。

このメソッドは Module#include の実体であり、
include を Ruby で書くと以下のように定義できます。

//emlist[例][ruby]{
d
ef include(*modules)
modules.reverse_each do |mod|
# append_features や included はプライ...
...ベートメソッドなので
# 直接 mod.append_features(self) などとは書けない
mod.__send__(:append_features, self)
mod.__send__(:included, self)
e
nd
e
nd
//}

@see Module#included...

Module#prepended(class_or_module) -> () (12306.0)

self が Module#prepend されたときに対象のクラスまたはモジュールを 引数にしてインタプリタがこのメソッドを呼び出します。

...self が Module#prepend されたときに対象のクラスまたはモジュールを
引数にしてインタプリタがこのメソッドを呼び出します。

@param class_or_module Module#prepend を実行したオブジェクト

//emlist[例][ruby]{
module A
d
ef self.prepended(mod)...
...puts "#{self} prepended to #{mod}"
e
nd
e
nd
module Enumerable
prepend A
e
nd
# => "A prepended to Enumerable"
//}

@see Module#included, Module#prepend, Module#prepend_features...

Object#extend(*modules) -> self (12306.0)

引数で指定したモジュールのインスタンスメソッドを self の特異 メソッドとして追加します。

...引数で指定したモジュールのインスタンスメソッドを self の特異
メソッドとして追加します。

Module#include は、クラス(のインスタンス)に機能を追加します
が、extend は、ある特定のオブジェクトだけにモジュールの機能を...
...ら逆順に extend を行います。

@param modules モジュールを任意個指定します(クラスは不可)。
@return self を返します。

//emlist[][ruby]{
module Foo
d
ef a
'ok Foo'
e
nd
e
nd

module Bar
d
ef b
'ok Bar'
e
nd
e
nd

obj = Object.new
obj.extend Foo, Bar
p...
...ude Foo
e
xtend Bar
e
nd

p Klass.new.a #=> "ok Foo"
p Klass.b #=> "ok Bar"
//}

e
xtend の機能は、「特異クラスに対する Module#include
と言い替えることもできます。
ただしその場合、フック用のメソッド
が Module#extended ではなく Module#included...

絞り込み条件を変える

Socket::Constants::IP_HDRINCL -> Integer (9316.0)

Header is included with data。 BasicSocket#getsockopt, BasicSocket#setsockopt の第2引数(optname)に使用します。

...Header is included with data。
BasicSocket#getsockopt, BasicSocket#setsockopt
の第2引数(optname)に使用します。

@see Socket::Constants::IPPROTO_IP,
ip(4freebsd)...

Socket::IP_HDRINCL -> Integer (9316.0)

Header is included with data。 BasicSocket#getsockopt, BasicSocket#setsockopt の第2引数(optname)に使用します。

...Header is included with data。
BasicSocket#getsockopt, BasicSocket#setsockopt
の第2引数(optname)に使用します。

@see Socket::Constants::IPPROTO_IP,
ip(4freebsd)...

Module#ancestors -> [Class, Module] (9312.0)

クラス、モジュールのスーパークラスとインクルードしているモジュール を優先順位順に配列に格納して返します。

...順位順に配列に格納して返します。

//emlist[例][ruby]{
module Foo
e
nd
class Bar
include Foo
e
nd
class Baz < Bar
p ancestors
p included_modules
p superclass
e
nd
# => [Baz, Bar, Foo, Object, Kernel, BasicObject]
# => [Foo, Kernel]
# => Bar
//}

@see Module#included_modules...
...先順位順に配列に格納して返します。

//emlist[例][ruby]{
module Foo
e
nd
class Bar
include Foo
e
nd
class Baz < Bar
p ancestors
p included_modules
p superclass
e
nd
# => [Baz, Bar, Foo, Object, Kernel, BasicObject]
# => [Foo, Kernel]
# => Bar
//}

@see Module#included_modules...

NEWS for Ruby 3.0.0 (6342.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...NEWS for Ruby 3.0.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...の変更

* Keyword arguments are now separated from positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplattin...
...}] # and deprecation warning
# 3.0 => a=>1}, {}]
//}

* Arguments forwarding (`...`) now supports leading arguments.
16378

//emlist{
d
ef method_missing(meth, ...)
send(:"do_#{meth}", ...)
e
nd
//}

* Pattern matching (`case/in`) is no longer experimental. 17260
* One-line pattern mat...

Module#>(other) -> bool | nil (6230.0)

比較演算子。 self が other の先祖である場合、true を返します。 self が other の子孫か同一クラスである場合、false を返します。

...self が other の先祖である場合、true を返します。
self が other の子孫か同一クラスである場合、false を返します。

継承関係にないクラス同士の比較では
nil を返します。

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

@raise TypeErr...
...her がクラスやモジュールではない場合に発生します。

@see Module#<

//emlist[例][ruby]{
module Awesome; end
module Included
include Awesome
e
nd
module Prepended
prepend Awesome
e
nd

Included
.ancestors # => [Included, Awesome]
Awesome > Included # => true
Included
> Awesome...
...# => false

Prepended.ancestors # => [Awesome, Prepended]
Awesome > Prepended # => true
Prepended > Awesome # => false

Awesome > Awesome # => false
Awesome > Object # => nil
//}...

絞り込み条件を変える

<< 1 2 > >>