るりまサーチ

最速Rubyリファレンスマニュアル検索!
975件ヒット [401-500件を表示] (0.093秒)

別のキーワード

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

検索結果

<< < ... 3 4 5 6 7 ... > >>

Module#<=(other) -> bool | nil (26.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.ancestors # => [F...

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

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

...ee 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 > Prepende...
...d # => true
Prepended > Awesome # => false

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

Module#>=(other) -> bool | nil (26.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.ancestors # => [F...

Module#alias_method(new, original) -> Symbol (26.0)

メソッドの別名を定義します。

...メソッドの別名を定義します。

//emlist[例][ruby]{
module
Kernel
alias_method :hoge, :puts # => :hoge
alias_method "foo", :puts # => :foo
end

//}

alias との違いは以下の通りです。

* メソッド名は String または Symbol で指定します
* グローバル...
...ます。

@param original 元のメソッド名。String または Symbol で指定します。

@return 作成したエイリアスのメソッド名を表す Symbol を返します。

@see d:spec/def#alias

//emlist[例][ruby]{
module
Kernel
alias_method :foo, :puts
end


foo "bar" # bar
//}...

Module#alias_method(new, original) -> self (26.0)

メソッドの別名を定義します。

...メソッドの別名を定義します。

//emlist[例][ruby]{
module
Kernel
alias_method :hoge, :puts # => Kernel
end

//}

alias との違いは以下の通りです。

* メソッド名は String または Symbol で指定します
* グローバル変数の別名をつけることはで...
...いメソッド名。String または Symbol で指定します。

@param original 元のメソッド名。String または Symbol で指定します。

@return self を返します。

@see d:spec/def#alias

//emlist[例][ruby]{
module
Kernel
alias_method :foo, :puts
end


foo "bar" # bar
//}...

絞り込み条件を変える

Module#ancestors -> [Class, Module] (26.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#attr(*name) -> nil (26.0)

インスタンス変数読み取りのためのインスタンスメソッド name を定義します。

...す。

//emlist[例][ruby]{
def name
@name
end

//}

第 2 引数 が true で指定された場合には、属性の書き込み用メソッド name= も同時に定義されます。
その定義は次の通りです。

//emlist[例][ruby]{
def name=(val)
@name = val
end

//}

第 2 引数 に...

Module#attr(name, false) -> nil (26.0)

インスタンス変数読み取りのためのインスタンスメソッド name を定義します。

...す。

//emlist[例][ruby]{
def name
@name
end

//}

第 2 引数 が true で指定された場合には、属性の書き込み用メソッド name= も同時に定義されます。
その定義は次の通りです。

//emlist[例][ruby]{
def name=(val)
@name = val
end

//}

第 2 引数 に...

Module#attr(name, true) -> nil (26.0)

インスタンス変数読み取りのためのインスタンスメソッド name を定義します。

...す。

//emlist[例][ruby]{
def name
@name
end

//}

第 2 引数 が true で指定された場合には、属性の書き込み用メソッド name= も同時に定義されます。
その定義は次の通りです。

//emlist[例][ruby]{
def name=(val)
@name = val
end

//}

第 2 引数 に...

Module#attr_reader(*name) -> [Symbol] (26.0)

インスタンス変数 name の読み取りメソッドを定義します。

.../emlist[例][ruby]{
class User
attr_reader :name # => [:name]
# 複数の名前を渡すこともできる
attr_reader :id, :age # => [:id, :age]
end

//}

このメソッドで定義されるメソッドの定義は以下の通りです。

//emlist[例][ruby]{
def name
@name
end

//}

@param...

絞り込み条件を変える

Module#attr_writer(*name) -> [Symbol] (26.0)

インスタンス変数 name への書き込みメソッド (name=) を定義します。

...例][ruby]{
class User
attr_writer :name # => [:name=]
# 複数の名前を渡すこともできる
attr_writer :id, :age # => [:id=, :age=]
end

//}

このメソッドで定義されるメソッドの定義は以下の通りです。

//emlist[例][ruby]{
def name=(val)
@name = val
end

//}...

Module#class_exec(*args) {|*vars| ... } -> object (26.0)

与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。

...[ruby]{
class Thing
end

c = 1

Thing.class_exec{
def hello()
"Hello there!"
end


define_method(:foo) do # ローカル変数がブロックの外側を参照している
c
end

}

t = Thing.new
p t.hello() #=> "Hello there!"
p t.foo() #=> 1
//}

@see Module...
...#module_eval, Module#class_eval...
<< < ... 3 4 5 6 7 ... > >>