るりまサーチ

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

別のキーワード

  1. symbol slice
  2. symbol []
  3. win32ole cp_symbol
  4. tracer event_symbol
  5. _builtin symbol

検索結果

<< 1 2 3 ... > >>

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...

絞り込み条件を変える

<< 1 2 3 ... > >>