るりまサーチ

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

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils rm_r
  5. fileutils cp_r

検索結果

<< 1 2 3 ... > >>

Module#ruby2_keywords(method_name, ...) -> nil (18433.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

...For the given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword argument...
...ash argument is marked with a special
flag such that if it is the final element of a normal argument splat to
another method call, and that method call does not include explicit
keywords or a keyword splat, the final element is interpreted as
keywords. In other words, keywords will be passed through...
...er methods.

This should only be used for methods that delegate keywords to another
method, and only for backwards compatibility with Ruby versions before
2.7.

This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
b
e...

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

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

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

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

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

@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 # => true
Included > Awesome # => false

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

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

Module#class_variables(inherit = true) -> [Symbol] (12408.0)

クラス/モジュールに定義されているクラス変数の名前の配列を返します。

...aram inherit false を指定しない場合はスーパークラスやインクルードして
いるモジュールのクラス変数を含みます。

//emlist[例][ruby]{
class One
@@var1 = 1
end
class Two < One
@@var2 = 2
end
One.class_variables # => [:@@var1]
Two.class_vari...
...ables # => [:@@var2, :@@var1]
Two.class_variables(false) # => [:@@var2]
//}

@see Module.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#constants...

Module#prepend_features(mod) -> self (12314.0)

Module#prepend から呼び出されるメソッドで、 prepend の処理の実体です。このメソッド自体は mod で指定した モジュール/クラスの継承チェインの先頭に self を追加します。

...Module#prepend から呼び出されるメソッドで、
prepend の処理の実体です。このメソッド自体は mod で指定した
モジュール/クラスの継承チェインの先頭に self を追加します。

このメソッドを上書きすることで、prepend の処理を変...
...ram mod prepend を呼び出したモジュール
@return mod が返されます

//emlist[例][ruby]{
class Recorder
R
ECORDS = []
end

module
X
def self.prepend_features(mod)
R
ecorder::RECORDS << mod
end
end

class A
prepend X
end

class B
include X
end

class C
prepend X
end

R
ecor...
...der::RECORDS # => [A, C]
//}

@see Module#prepend, Module#prepended...

Module#class_variable_defined?(name) -> bool (12308.0)

name で与えられた名前のクラス変数がモジュールに存在する場合 true を 返します。

...true を
返します。

@param name Symbol か String を指定します。

//emlist[例][ruby]{
class Fred
@@foo = 99
end
Fred.class_variable_defined?(:@@foo) #=> true
Fred.class_variable_defined?(:@@bar) #=> false
Fred.class_variable_defined?('@@foo') #=> true
Fred.class_variable_de...
...fined?('@@bar') #=> false
//}...

絞り込み条件を変える

Module#class_variable_get(name) -> object (12308.0)

クラス/モジュールに定義されているクラス変数 name の値を返します。

...の値を返します。

@param name String または Symbol を指定します。

@raise NameError クラス変数 name が定義されていない場合、発生します。

//emlist[例][ruby]{
class Fred
@@foo = 99
end

def Fred.foo
class_variable_get(:@@foo)
end

p Fred.foo #=> 99
//}...

Module#class_variable_set(name, val) -> object (12308.0)

クラス/モジュールにクラス変数 name を定義して、その値として val をセットします。val を返します。

...をセットします。val を返します。

@param name String または Symbol を指定します。

//emlist[例][ruby]{
class Fred
@@foo = 99
def foo
@@foo
end
end

def Fred.foo(val)
class_variable_set(:@@foo, val)
end

p Fred.foo(101) # => 101
p Fred.new.foo # => 101
//}...

Module#remove_class_variable(name) -> object (12308.0)

引数で指定したクラス変数を取り除き、そのクラス変数に設定さ れていた値を返します。

...クラス変数に設定さ
れていた値を返します。

@param name String または Symbol を指定します。

@return 引数で指定されたクラス変数に設定されていた値を返します。

@raise NameError 引数で指定されたクラス変数がそのモジュールや...
...クラスに定義されていない場合に発生します。

//emlist[例][ruby]{
class Foo
@@foo = 1
r
emove_class_variable(:@@foo) # => 1
p @@foo # => uninitialized class variable @@foo in Foo (NameError)
end
//}

@see Module#remove_const, Object#remove_instance_variable...

Module#private(name) -> String | Symbol (6420.0)

メソッドを private に設定します。

...メソッドを private に設定します。

引数なしのときは今後このクラスまたはモジュール定義内で新規に定義さ
れるメソッドを関数形式でだけ呼び出せるように(private)設定します。

引数が与えられた時には引数によって指定...
...ッドを private に
設定します。

可視性については d:spec/def#limit を参照して下さい。

@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。

@raise NameError 存在し...
...[例][ruby]{
class Foo
def foo1() 1 end # デフォルトでは public
private # 可視性を private に変更
def foo2() 2 end # foo2 は private メソッド
end

foo = Foo.new
p foo.foo1 # => 1
p foo.foo2 # => private method `foo2' called for #<Foo...
<< 1 2 3 ... > >>