るりまサーチ

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

別のキーワード

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

検索結果

<< 1 2 3 ... > >>

Module#ruby2_keywords(method_name, ...) -> nil (12233.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...
...other 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 version...

Module#prepend_features(mod) -> self (12208.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_variables(inherit = true) -> [Symbol] (6208.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#private(name) -> String | Symbol (6208.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...

Module#private_instance_methods(inherited_too = true) -> [Symbol] (6208.0)

そのモジュールで定義されている private メソッド名 の一覧を配列で返します。

...る private メソッド名
の一覧を配列で返します。

@param inherited_too false を指定するとそのモジュールで定義されているメソッドのみ返します。

@see Object#private_methods, Module#instance_methods

//emlist[例][ruby]{
module
Foo
def foo; end
privat...
...e def bar; end
end

module
Bar
include Foo

def baz; end
private def qux; end
end

Bar.private_instance_methods # => [:qux, :bar]
Bar.private_instance_methods(false) # => [:qux]
//}...

絞り込み条件を変える

Module#private_method_defined?(name, inherit=true) -> bool (6208.0)

インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が private であるときに true を返します。 そうでなければ false を返します。

...ジュールに定義されており、
しかもその可視性が private であるときに true を返します。
そうでなければ false を返します。

@param name Symbol か String を指定します。
@param inherit 真を指定するとスーパークラスや include したモジ...
...ee Module#method_defined?, Module#public_method_defined?, Module#protected_method_defined?

//emlist[例][ruby]{
module
A
def method1() end
end
class B
private
def method2() end
end
class C < B
include A
def method3() end
end

A.method_defined? :method1 #=> true
C.priv...
...ate_method_defined? "method1" #=> false
C.private_method_defined? "method2" #=> true
C.private_method_defined? "method2", true #=> true
C.private_method_defined? "method2", false #=> false
C.method_defined? "method2" #=> false
//}...

Module#attr(*name) -> [Symbol] (6120.0)

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

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

このメソッドで定義されるアクセスメソッドの定義は次の通りです。

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

第 2 引数 が true...
...
その定義は次の通りです。

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

第 2 引数 に true か false を指定する方法は非推奨です。

@param name String または Symbol で指定します。
@return 定義されたメソッド名を Symbol の配列で返...

Module#attr(name, false) -> [Symbol] (6120.0)

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

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

このメソッドで定義されるアクセスメソッドの定義は次の通りです。

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

第 2 引数 が true...
...
その定義は次の通りです。

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

第 2 引数 に true か false を指定する方法は非推奨です。

@param name String または Symbol で指定します。
@return 定義されたメソッド名を Symbol の配列で返...

Module#attr(name, true) -> [Symbol] (6120.0)

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

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

このメソッドで定義されるアクセスメソッドの定義は次の通りです。

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

第 2 引数 が true...
...
その定義は次の通りです。

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

第 2 引数 に true か false を指定する方法は非推奨です。

@param name String または Symbol で指定します。
@return 定義されたメソッド名を Symbol の配列で返...

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

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

... Module#include の実体であり、
include を Ruby で書くと以下のように定義できます。

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

@see Module#included...

絞り込み条件を変える

Module#attr(*name) -> nil (6114.0)

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

...list[例][ruby]{
def name
@name
end
//}

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

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

第 2 引数 に true か fa...
...lse を指定する方法は非推奨です。

@param name String または Symbol で指定します。...
<< 1 2 3 ... > >>