712件ヒット
[1-100件を表示]
(0.088秒)
ライブラリ
- ビルトイン (635)
- delegate (33)
-
irb
/ extend-command (11) -
rdoc
/ context (22) -
rdoc
/ top _ level (11)
クラス
- BasicObject (44)
- Delegator (33)
- Method (33)
- Module (316)
- NameError (11)
- Object (154)
- Proc (11)
-
RDoc
:: Context (22) -
RDoc
:: TopLevel (11) -
RubyVM
:: InstructionSequence (11) - Thread (11)
- TracePoint (22)
- UnboundMethod (22)
モジュール
キーワード
- [] (11)
-
alias
_ method (11) -
callee
_ id (11) -
define
_ method (22) -
define
_ singleton _ method (22) -
find
_ local _ symbol (22) -
find
_ symbol (11) -
install
_ alias _ method (11) -
instance
_ method (11) -
instance
_ methods (11) -
method
_ added (11) -
method
_ defined? (11) -
method
_ id (11) -
method
_ missing (11) -
method
_ removed (11) -
method
_ undefined (11) - methods (22)
-
module
_ function (19) - name (33)
-
original
_ name (22) - parameters (22)
- private (23)
-
private
_ class _ method (15) -
private
_ instance _ methods (11) -
private
_ method _ defined? (11) -
private
_ methods (11) - protected (23)
-
protected
_ instance _ methods (11) -
protected
_ method _ defined? (11) -
protected
_ methods (22) - public (23)
-
public
_ class _ method (15) -
public
_ instance _ method (11) -
public
_ instance _ methods (11) -
public
_ method (11) -
public
_ method _ defined? (11) -
public
_ methods (22) -
remove
_ method (11) -
respond
_ to? (11) -
respond
_ to _ missing? (11) - send (22)
-
singleton
_ method (11) -
singleton
_ method _ added (11) -
singleton
_ method _ removed (11) -
singleton
_ method _ undefined (11) -
singleton
_ methods (11) -
to
_ a (11) -
undef
_ method (11)
検索結果
先頭5件
-
Object
# method(name) -> Method (18255.0) -
オブジェクトのメソッド name をオブジェクト化した Method オブジェクトを返します。
...した
Method オブジェクトを返します。
@param name メソッド名をSymbol またはStringで指定します。
@raise NameError 定義されていないメソッド名を引数として与えると発生します。
//emlist[][ruby]{
me = -365.method(:abs)
p me #=> #<Method: Integer#......abs>
p me.call #=> 365
//}
@see Module#instance_method, Method, BasicObject#__send__, Object#send, Kernel.#eval, Object#singleton_method... -
Method
# name -> Symbol (9114.0) -
このメソッドの名前を返します。
...このメソッドの名前を返します。
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.name # => :foo
//}... -
Method
# original _ name -> Symbol (9108.0) -
オリジナルのメソッド名を返します。
...オリジナルのメソッド名を返します。
//emlist[例][ruby]{
class C
def foo; end
alias bar foo
end
C.new.method(:bar).original_name # => :foo
//}
@see UnboundMethod#original_name... -
Method
# parameters -> [object] (9053.0) -
Method オブジェクトの引数の情報を返します。
...Method オブジェクトの引数の情報を返します。
Method オブジェクトが引数を取らなければ空の配列を返します。引数を取る場合は、配列の配列を返し、
各配列の要素は引数の種類に応じた以下のような Symbol と、仮引数の名......前を表す Symbol の 2 要素です。
組み込みのメソッドでは、仮引数の名前が取れません。
: :req
必須の引数
: :opt
デフォルト値が指定されたオプショナルな引数
: :rest
* で指定された残りすべての引数
: :keyreq
必須のキーワ......数
//emlist[例][ruby]{
m = Class.new{define_method(:m){|x, y=42, *other, k_x:, k_y: 42, **k_other, &b|}}.instance_method(:m)
m.parameters #=> x], [:opt, :y], [:rest, :other], [:keyreq, :k_x], [:key, :k_y], [:keyrest, :k_other], [:block, :b
File.method(:symlink).parameters #=> req
//}
@see Proc#p... -
Object
# define _ singleton _ method(symbol , method) -> Symbol (6450.0) -
self に特異メソッド name を定義します。
...を定義します。
@param symbol メソッド名を String または Symbol で指定します。
@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。
@return メソッド名を表す Symbol を返します。
//emlist......[][ruby]{
class A
class << self
def class_name
to_s
end
end
end
A.define_singleton_method(:who_am_i) do
"I am: #{class_name}"
end
A.who_am_i # ==> "I am: A"
guy = "Bob"
guy.define_singleton_method(:hello) { "#{self}: Hello there!" }
guy.hello #=> "Bob: Hello there!"
//}... -
RDoc
:: Context # find _ symbol(symbol , method=nil) (6368.0) -
Look up the given symbol. If method is non-nil, then we assume the symbol references a module that contains that method
...Look up the given symbol. If method is non-nil, then we assume
the symbol references a module that contains that method... -
Object
# define _ singleton _ method(symbol) { . . . } -> Symbol (6350.0) -
self に特異メソッド name を定義します。
...を定義します。
@param symbol メソッド名を String または Symbol で指定します。
@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。
@return メソッド名を表す Symbol を返します。
//emlist......[][ruby]{
class A
class << self
def class_name
to_s
end
end
end
A.define_singleton_method(:who_am_i) do
"I am: #{class_name}"
end
A.who_am_i # ==> "I am: A"
guy = "Bob"
guy.define_singleton_method(:hello) { "#{self}: Hello there!" }
guy.hello #=> "Bob: Hello there!"
//}... -
Module
# define _ method(name , method) -> Symbol (6348.0) -
インスタンスメソッド name を定義します。
...ソッド名を String または Symbol を指定します。
@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。
@return メソッド名を表す Symbol を返します。
@raise TypeError method に同じクラス、サブク......ラス、モジュール以外のメソッ
ドを指定した場合に発生します。
//emlist[例][ruby]{
class Foo
def foo() p :foo end
define_method(:bar, instance_method(:foo))
end
Foo.new.bar # => :foo
//}... -
Module
# method _ defined?(name , inherit=true) -> bool (6276.0) -
モジュールにインスタンスメソッド name が定義されており、 かつその可視性が public または protected であるときに true を返します。
...m name Symbol か String を指定します。
@param inherit 真を指定するとスーパークラスや include したモジュールで
定義されたメソッドも対象になります。
@see Module#public_method_defined?, Module#private_method_defined?, Module#protected_method_defi......def method1() end
def protected_method1() end
protected :protected_method1
end
class B
def method2() end
def private_method2() end
private :private_method2
end
class C < B
include A
def method3() end
end
A.method_defined? :method1 #=> true
C.method_defined? "method1"......#=> true
C.method_defined? "method2" #=> true
C.method_defined? "method2", true #=> true
C.method_defined? "method2", false #=> false
C.method_defined? "method3" #=> true
C.method_defined? "protected_method1" #=> true
C.method_defined? "method4"... -
Object
# public _ method(name) -> Method (6261.0) -
オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。
...オブジェクトの public メソッド name をオブジェクト化した
Method オブジェクトを返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError 定義されていないメソッド名や、
protected メソッド名、......vate メソッド名を引数として与えると発生します。
//emlist[][ruby]{
1.public_method(:to_int) #=> #<Method: Integer#to_int>
1.public_method(:p) # method `p' for class `Integer' is private (NameError)
//}
@see Object#method,Object#public_send,Module#public_instance_method...