るりまサーチ

最速Rubyリファレンスマニュアル検索!
143件ヒット [1-100件を表示] (0.069秒)

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Module#include(*mod) -> self (18222.0)

モジュール mod をインクルードします。

...ます。

@
param mod Module のインスタンス( Enumerable など)を指定します。

@
raise ArgumentError 継承関係が循環してしまうような include を行った場合に発生します。

//emlist[例][ruby]{
module M
end
module M2
include
M
end
module M
include
M2
end
//}...
...実行結果:

-:3:in `append_features': cyclic include detected (ArgumentError)
from -:3:in `include'
from -:3


インクルードとは、指定されたモジュールの定義
(メソッド、定数) を引き継ぐことです。
インクルードは多重継承の代わ...
...りに用いられており、 mix-in とも呼びます。

//emlist[例][ruby]{
class C
include
FileTest
include
Math
end

p C.ancestors

# => [C, Math, FileTest, Object, Kernel]
//}

モジュールの機能追加は、クラスの継承関係の間にそのモジュールが挿入
される...

Object#respond_to?(name, include_all = false) -> bool (192.0)

オブジェクトがメソッド name を持つとき真を返します。

...します。

※ NotImplementedError が発生する場合に false を返すのは
Ruby
の組み込みライブラリや標準ライブラリなど、C言語で実装されているメソッドのみです。
Ruby
で実装されたメソッドで NotImplementedError が発生する場合は true...
...れていない場合は、Object#respond_to_missing? を呼
び出してその結果を返します。

@
param name Symbol または文字列で指定するメソッド名です。

@
param include_all private メソッドと protected メソッドを確認の対象に
含める...
...true か false で指定します。省略した場合
は false(含めない) を指定した事になります。

//emlist[][ruby]{
class F
def hello
"Bonjour"
end
end

class D
private
def hello
"Guten Tag"
end
end
list = [F.new,D.new]

list.each{|it| puts it...

Module#const_get(name, inherit = true) -> object (79.0)

name で指定される名前の定数の値を取り出します。

...とはありません。

@
param name 定数名。String か Symbol で指定します。
完全修飾名を指定しなかった場合はモジュールに定義されている
name で指定される名前の定数の値を取り出します。

@
param inherit false を指...
...クラスや include したモジュールで
定義された定数は対象にはなりません。

@
raise NameError 定数が定義されていないときに発生します。

//emlist[例][ruby]{
module Bar
BAR = 1
end
class Object
include
Bar
end
# Object では include された...
...Baz
include
Bar
end
# Object以外でも同様
p Baz.const_get(:BAR) # => 1
# 定義されていない定数
p Baz.const_get(:NOT_DEFINED) #=> raise NameError
# 第二引数に false を指定すると自分自身に定義された定数から探す
p Baz.const_get(:BAR, false) #=> raise Nam...

Module#<=(other) -> bool | nil (43.0)

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

...の比較では
nil を返します。

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

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

@
see Module#<

//emlist[例][ruby]{
module Foo; end
module Bar
include
Foo
end
module Baz
prepend Foo
end...

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

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

...

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

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

@
see Module#<

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

Include
d.a...
...ncestors # => [Included, Awesome]
Awesome > Included # => true
Include
d > Awesome # => false

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

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

絞り込み条件を変える

Module#>=(other) -> bool | nil (43.0)

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

...の比較では
nil を返します。

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

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

@
see Module#<

//emlist[例][ruby]{
module Foo; end
module Bar
include
Foo
end
module Baz
prepend Foo
end...

UnboundMethod#bind(obj) -> Method (43.0)

self を obj にバインドした Method オブジェクトを生成して返します。

...ェクトを生成して返します。


@
param obj 自身をバインドしたいオブジェクトを指定します。ただしバインドできるのは、
生成元のクラスかそのサブクラスのインスタンスのみです。

@
raise TypeError objがbindできないオ...
...ブジェクトである場合に発生します

//emlist[例][ruby]{
# クラスのインスタンスメソッドの UnboundMethod の場合
class Foo
def foo
"foo"
end
end

# UnboundMethod `m' を生成
p m = Foo.instance_method(:foo) # => #<UnboundMethod: Foo#foo>

# Foo のインスタ...
..._method(:foo) # => #<UnboundMethod: Foo#foo>

# Foo をインクルードしたクラス Bar のインスタンスをレシーバと
# する Method オブジェクトを生成
class Bar
include
Foo
end
p m.bind(Bar.new) # => #<Method: Bar(Foo)#foo>
//}

@
see UnboundMethod#bind_call...

Module#<(other) -> bool | nil (37.0)

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

...同士の比較では
nil を返します。

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

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

//emlist[例][ruby]{
module Foo
end
class Bar
include
Foo
end
class Baz < Bar
end
class Qux
end
p Bar...

Pathname#entries -> [Pathname] (37.0)

self に含まれるファイルエントリ名を元にした Pathname オブジェクトの配列を返します。

...リ名を元にした Pathname オブジェクトの配列を返します。

@
raise Errno::EXXX self が存在しないパスであったりディレクトリでなければ例外が発生します。

//emlist[例][ruby]{
require 'pathname'
require 'pp'

pp Pathname('/usr/local').entries
# => [#<P...
...athname:.>,
# #<Pathname:..>,
# #<Pathname:bin>,
# #<Pathname:etc>,
# #<Pathname:include>,
# #<Pathname:lib>,
# #<Pathname:opt>,
# #<Pathname:sbin>,
# #<Pathname:share>,
# #<Pathname:var>]
//}

@
see Dir.entries...
<< 1 2 > >>