るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

検索結果

<< 1 2 > >>

Object#methods(include_inherited = true) -> [Symbol] (18258.0)

そのオブジェクトに対して呼び出せるメソッド名の一覧を返します。 このメソッドは public メソッドおよび protected メソッドの名前を返します。

...のメソッドは public メソッドおよび protected メソッドの名前を返します。

ただし特別に、引数が偽の時は Object#singleton_methods(false) と同じになっています。


@param include_inherited 引数が偽の時は Object#singleton_methods(false) と同じ...
...

//emlist[例1][ruby]{
class Parent
p
rivate; def private_parent() end
p
rotected; def protected_parent() end
p
ublic; def public_parent() end
end

class Foo < Parent
p
rivate; def private_foo() end
p
rotected; def protected_foo() end
p
ublic; def public_foo() end
end...
...j
p
rivate; def private_singleton() end
p
rotected; def protected_singleton() end
p
ublic; def public_singleton() end
end

# あるオブジェクトの応答できるメソッドの一覧を得る。
p
obj.methods(false)
p
obj.public_methods(false)
p
obj.private_methods(false)
p
...

Refinement#import_methods(*modules) -> self (12244.0)

モジュールからメソッドをインポートします。

...ポートします。

Module#includeと違って、import_methods はメソッドをコピーして
refinement に追加して、refinementでインポートしたメソッドを有効化します。

メソッドをコピーするため、Rubyコードで定義されたメソッドだけしか
...
...[ruby]{
module StrUtils
def indent(level)
' ' * level + self
end
end

module M
refine String do
import_methods StrUtils
end
end

using M
p
"foo".indent(3) # => " foo"

module M
refine String do
import_methods Enumerable
# Can't import method which is not defined with Ruby...
...code: Enumerable#drop
end
end
//}...

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

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

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

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

@see Object#private_methods, Module#instance_methods

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

module Bar
include Foo

def baz; end
p
rivate def qux; end
end

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

Proc#ruby2_keywords -> proc (9248.0)

Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc 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 proc to other methods.

...e proc as passing keywords through a normal argument splat. This
should only be called on procs that accept an argument splat (`*args`)
but not explicit keywords or a keyword splat. It marks the proc such
that if the proc is called with keyword arguments, the final hash
argument is marked with a sp...
...f 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 proc to other methods.

This should only be used for procs that delegate ke...
...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
before 2.7, check that the proc responds to this method before calling
it. Als...

Module#instance_methods(inherited_too = true) -> [Symbol] (6240.0)

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

... public および protected メソッド名
の一覧を配列で返します。

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

@see Object#methods

//emlist[例1][ruby]{
class Foo
p
rivate; def private_foo() end
p
...
...rotected; def protected_foo() end
p
ublic; def public_foo() end
end

# あるクラスのインスタンスメソッドの一覧を得る
p
Foo.instance_methods(false)
p
Foo.public_instance_methods(false)
p
Foo.private_instance_methods(false)
p
Foo.protected_instance_methods(false)

class Bar...
...< Foo
end
//}

実行結果

[:protected_foo, :public_foo]
[:public_foo]
[:private_foo]
[:protected_foo]

//emlist[例2][ruby]{
class Bar
p
rivate; def private_foo() end
p
rotected; def protected_foo() end
p
ublic; def public_foo() end
end

# あるクラスのイ...

絞り込み条件を変える

Object#singleton_methods(inherited_too = true) -> [Symbol] (6198.0)

そのオブジェクトに対して定義されている特異メソッド名 (public あるいは protected メソッド) の一覧を返します。

...そのオブジェクトに対して定義されている特異メソッド名
(public あるいは protected メソッド) の一覧を返します。

inherited_too が真のときは継承した特異メソッドを含みます。
継承した特異メソッドとは Object#extend によって追...
...eton_methods(false) は、Object#methods(false) と同じです。

@param inherited_too 継承した特異メソッドを含める場合は真を、
そうでない場合は偽を指定します。

//emlist[例1][ruby]{
P
arent = Class.new

class <<Parent
p
rivate; def priva...
..._class_parent() end
p
rotected; def protected_class_parent() end
p
ublic; def public_class_parent() end
end

Foo = Class.new(Parent)

class <<Foo
p
rivate; def private_class_foo() end
p
rotected; def protected_class_foo() end
p
ublic; def public_class_foo() end
end

module Bar
p
rivate...

Object#initialize_copy(obj) -> object (6155.0)

(拡張ライブラリによる) ユーザ定義クラスのオブジェクトコピーの初期化メソッド。

...

デフォルトでは、Object#clone の内部で Object#initialize_clone から、
また Object#dup の内部で Object#initialize_dup から呼ばれます。

initialize_copy は、Ruby インタプリタが知り得ない情報をコピーするた
めに使用(定義)されます。例え...
...lize_copy でコピーするよう定義しておくことで、dup や clone
を再定義する必要がなくなります。

デフォルトの Object#initialize_copy は、 freeze チェックおよび型のチェックを行い self
を返すだけのメソッドです。

initialize_copy と...
...のメソッドは
自動的に private に設定されます。

@raise TypeError レシーバが freeze されているか、obj のクラスがレシーバ
のクラスと異なる場合に発生します。
@see Object#clone,Object#dup

以下に例として、dup や clone がこのメソッ...

Enumerable#grep(pattern) -> [object] (6113.0)

pattern === item が成立する要素を全て含んだ配列を返します。

...
p
attern === item が成立する要素を全て含んだ配列を返します。

ブロックとともに呼び出された時には条件の成立した要素に対して
それぞれブロックを評価し、その結果の配列を返します。
マッチする要素がひとつもなかっ...
...す。

@param pattern 「===」メソッドを持つオブジェクトを指定します。

//emlist[例][ruby]{
['aa', 'bb', 'cc', 'dd', 'ee'].grep(/[bc]/) # => ["bb", "cc"]

Array.instance_methods.grep(/gr/) # => [:grep, :grep_v, :group_by]
//}

@see Enumerable#select
@see Enumerable#grep_v...

Enumerable#grep(pattern) {|item| ... } -> [object] (6113.0)

pattern === item が成立する要素を全て含んだ配列を返します。

...
p
attern === item が成立する要素を全て含んだ配列を返します。

ブロックとともに呼び出された時には条件の成立した要素に対して
それぞれブロックを評価し、その結果の配列を返します。
マッチする要素がひとつもなかっ...
...す。

@param pattern 「===」メソッドを持つオブジェクトを指定します。

//emlist[例][ruby]{
['aa', 'bb', 'cc', 'dd', 'ee'].grep(/[bc]/) # => ["bb", "cc"]

Array.instance_methods.grep(/gr/) # => [:grep, :grep_v, :group_by]
//}

@see Enumerable#select
@see Enumerable#grep_v...

WIN32OLE_TYPE#default_event_sources -> [WIN32OLE_TYPE] (3155.0)

型が持つソースインターフェイスを取得します。

...PEの配列と
して返します。返すのは配列ですが、デフォルトのソースインターフェ
イスは最大でも1インターフェイスです。ソースインターフェイスを持
たない場合は空配列を返します。

tobj = WIN32OLE_TYP...
...E.new('Microsoft Excel 14.0 Object Library', 'Worksheet')
tobj.default_event_sources.map {|intf| intf.name} #=> ["DocEvents"]

WIN32OLE_EVENT.newでインターフェイス名を指定しない場合は、ここで
返されたインターフェイスが選択されます。

次のサンプル...
...loopの呼び出しが必要な点に注意してください。
ここでは最終イベントのStatusTextChangeイベントのメッセージについては既
知としています。

# coding : cp932
require 'win32ole'

type = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'InternetExplo...

絞り込み条件を変える

<< 1 2 > >>