るりまサーチ

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

別のキーワード

  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...
...s will be passed through the method to
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...
...ot exist in Ruby versions
b
efore 2.7, check that the module responds to this method before calling
it. Also, be aware that if this method is removed, the behavior of the
method will change so that it does not pass through keywords.

//emlist[例][ruby]{
module
Mod
def foo(meth, *args, &block)...

Module#extend_object(obj) -> object (6314.0)

Object#extend の実体です。オブジェクトにモジュールの機能を追加します。

...Object#extend の実体です。オブジェクトにモジュールの機能を追加します。

Object#extend は、Ruby で書くと以下のように定義できます。

//emlist[例][ruby]{
def extend(*modules)
module
s.reverse_each do |mod|
# extend_object や extended はプライ...
...
# 直接 mod.extend_object(self) などとは書けない
mod.__send__(:extend_object, self)
mod.__send__(:extended, self)
end
end
//}

extend_object のデフォルトの実装では、self に定義されて
いるインスタンスメソッドを obj の特異メソッドとし...
...て追加します。

@param obj self の機能を追加するオブジェクトを指定します。

@return obj で指定されたオブジェクトを返します。

@see Module#extended...

Module#public_method_defined?(name, inherit=true) -> bool (6120.0)

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

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

@param name Symbol か String を指定します。
@param inherit 真を指定するとスーパークラス...
...e Module#method_defined?, Module#private_method_defined?, Module#protected_method_defined?

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

A.method_defined? :method1 #=> true
C.publ...
...ic_method_defined? "method1" #=> true
C.public_method_defined? "method1", true #=> true
C.public_method_defined? "method1", false #=> true
C.public_method_defined? "method2" #=> false
C.method_defined? "method2" #=> true
//}...

Module#public() -> nil (6114.0)

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

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

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

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

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

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

@raise NameErr...
...st[例][ruby]{
def foo() 1 end
p foo # => 1
# the toplevel default is private
p self.foo # => private method `foo' called for #<Object:0x401c83b0> (NoMethodError)

def bar() 2 end
public :bar # visibility changed (all access allowed)
p bar # => 2
p self.bar...

Module#public(*name) -> Array (6114.0)

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

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

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

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

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

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

@raise NameErr...
...st[例][ruby]{
def foo() 1 end
p foo # => 1
# the toplevel default is private
p self.foo # => private method `foo' called for #<Object:0x401c83b0> (NoMethodError)

def bar() 2 end
public :bar # visibility changed (all access allowed)
p bar # => 2
p self.bar...

絞り込み条件を変える

Module#public(name) -> String | Symbol (6114.0)

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

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

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

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

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

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

@raise NameErr...
...st[例][ruby]{
def foo() 1 end
p foo # => 1
# the toplevel default is private
p self.foo # => private method `foo' called for #<Object:0x401c83b0> (NoMethodError)

def bar() 2 end
public :bar # visibility changed (all access allowed)
p bar # => 2
p self.bar...

Module#public(names) -> Array (6114.0)

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

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

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

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

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

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

@raise NameErr...
...st[例][ruby]{
def foo() 1 end
p foo # => 1
# the toplevel default is private
p self.foo # => private method `foo' called for #<Object:0x401c83b0> (NoMethodError)

def bar() 2 end
public :bar # visibility changed (all access allowed)
p bar # => 2
p self.bar...

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

name で与えられた名前のクラス変数がモジュールに存在する場合 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_defined?('@@bar') #=> fal...

Module#class_variable_get(name) -> object (6108.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
//}...
<< 1 2 3 ... > >>