るりまサーチ

最速Rubyリファレンスマニュアル検索!
362件ヒット [1-100件を表示] (0.024秒)
トップページ > クラス:Module[x] > クエリ:Method[x]

別のキーワード

  1. irb/input-method new
  2. irb/input-method gets
  3. _builtin define_method
  4. irb/input-method encoding
  5. irb/input-method readable_atfer_eof?

検索結果

<< 1 2 3 ... > >>

Module#method_defined?(name, inherit=true) -> bool (6270.0)

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

...e Module#public_method_defined?, Module#private_method_defined?, Module#protected_method_defined?

//emlist[例][ruby]{
module
A
def method1() end
def protected_method1() end
protected :protected_method1
end
class B
def method2() end
def private_method2() end
private :private_method2...
...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" #=> false
C.method_defined? "private_method2" #=> false
//}...

Module#method_defined?(name) -> bool (6246.0)

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

...e Module#public_method_defined?, Module#private_method_defined?, Module#protected_method_defined?

//emlist[例][ruby]{
module
A
def method1() end
def protected_method1() end
protected :protected_method1
end
class B
def method2() end
def private_method2() end
private :private_method2...
...def method3() end
end

A.method_defined? :method1 #=> true
C.method_defined? "method1" #=> true
C.method_defined? "method2" #=> true
C.method_defined? "method3" #=> true
C.method_defined? "protected_method1" #=> true
C.method_defined? "method4"...
...#=> false
C.method_defined? "private_method2" #=> false
//}...

Module#instance_method(name) -> UnboundMethod (6238.0)

self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。

...クト化した UnboundMethod を返します。

@param name メソッド名を Symbol または String で指定します。

@raise NameError self に存在しないメソッドを指定した場合に発生します。

@see Module#public_instance_method, Object#method

//emlist[例][ruby]{
clas...
...() print "!\n"; end
def do_v() print "Dave"; end
Dispatcher = {
"a" => instance_method(:do_a),
"d" => instance_method(:do_d),
"e" => instance_method(:do_e),
"v" => instance_method(:do_v)
}
def interpret(string)
string.each_char {|b| Dispatcher[b].bind(self).call }...

Module#define_method(name, method) -> Symbol (6234.0)

インスタンスメソッド name を定義します。

...ring または 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#public_instance_method(name) -> UnboundMethod (6232.0)

self の public インスタンスメソッド name をオブジェクト化した UnboundMethod を返します。

...self の public インスタンスメソッド name をオブジェクト化した UnboundMethod を返します。

@param name メソッド名を Symbol または String で指定します。

@raise NameError 定義されていないメソッド名や、
protected メソッド名、 priva...
...として与えると発生します。

//emlist[例][ruby]{
Kernel.public_instance_method(:object_id) #=> #<UnboundMethod: Kernel#object_id>
Kernel.public_instance_method(:p) # method `p' for module `Kernel' is private (NameError)
//}

@see Module#instance_method,Object#public_method...

絞り込み条件を変える

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

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

...ります。

@see 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.private_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#protected_method_defined?(name, inherit=true) -> bool (6210.0)

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

...ります。

@see Module#method_defined?, Module#public_method_defined?, Module#private_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.protected_method_defined? "method1" #=> false
C.protected_method_defined? "method2" #=> true
C.protected_method_defined? "method2", true #=> true
C.protected_method_defined? "method2", false #=> false
C.method_defined? "method2" #=> true
//}...

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

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

...ます。

@see 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.public_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#private_method_defined?(name) -> bool (6186.0)

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

...します。

@see 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.private_method_defined? "method1" #=> false
C.private_method_defined? "method2" #=> true
C.method_defined? "method2" #=> false
//}...

Module#protected_method_defined?(name) -> bool (6186.0)

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

...します。

@see Module#method_defined?, Module#public_method_defined?, Module#private_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.protected_method_defined? "method1" #=> false
C.protected_method_defined? "method2" #=> true
C.method_defined? "method2" #=> true
//}...

絞り込み条件を変える

Module#public_method_defined?(name) -> bool (6186.0)

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

...ます。

@see 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.public_method_defined? "method1" #=> true
C.public_method_defined? "method2" #=> false
C.method_defined? "method2" #=> true
//}...

Module#method_undefined(name) -> () (6154.0)

このモジュールのインスタンスメソッド name が Module#undef_method によって削除されるか、 undef 文により未定義にされると、インタプリタがこのメソッドを呼び出します。

...ンスメソッド name が
Module
#undef_method によって削除されるか、
undef 文により未定義にされると、インタプリタがこのメソッドを呼び出します。

特異メソッドの削除をフックするには
BasicObject#singleton_method_undefined
を使います...
...ド名が Symbol で渡されます。

//emlist[例][ruby]{
class C
def C.method_undefined(name)
puts "method C\##{name} was undefined"
end

def foo
end
def bar
end

undef_method :foo
undef bar
end
//}

実行結果:

method
C#foo was undefined
method
C#bar was undefined...

Module#method_removed(name) -> () (6148.0)

メソッドが Module#remove_method により削除 された時にインタプリタがこのメソッドを呼び出します。

...メソッドが Module#remove_method により削除
された時にインタプリタがこのメソッドを呼び出します。

特異メソッドの削除に対するフックには
BasicObject#singleton_method_removed
を使います。

@param name 削除されたメソッド名が Symbol...
...で渡されます。

//emlist[例][ruby]{
class Foo
def Foo.method_removed(name)
puts "method \"#{name}\" was removed"
end

def foo
end
remove_method :foo
end

# => method "foo" was removed
//}...

Module#method_added(name) -> () (6144.0)

メソッド name が追加された時にインタプリタがこのメソッドを呼び出します。

..._method_added
を使います。

@param name 追加されたメソッドの名前が Symbol で渡されます。

//emlist[例][ruby]{
class Foo
def Foo.method_added(name)
puts "method \"#{name}\" was added"
end

def foo
end
define_method :bar, instance_method(:foo)
end

# => method...
..."foo" was added
# method "bar" was added
//}...
<< 1 2 3 ... > >>