るりまサーチ

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

別のキーワード

  1. bigdecimal/util to_d
  2. float to_d
  3. matrix d
  4. kernel $-d
  5. rsa d

検索結果

<< 1 2 3 ... > >>

Module#protected_method_defined?(name, inherit=true) -> bool (15411.0)

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

...り、
しかもその可視性が protected であるときに true を返します。
そうでなければ false を返します。

@param name Symbol か String を指定します。
@param inherit 真を指定するとスーパークラスや include したモジュールで
定義さ...
...ります。

@see Module#method_defined?, Module#public_method_defined?, Module#private_method_defined?

//emlist[例][ruby]{
module
A
d
ef method1() end
end
class B
protected
d
ef method2() end
end
class C < B
include A
d
ef 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#method_defined?(name, inherit=true) -> bool (12371.0)

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

...ted であるときに
true を返します。

@param name Symbol か String を指定します。
@param inherit 真を指定するとスーパークラスや include したモジュールで
定義されたメソッドも対象になります。

@see Module#public_method_defined?, Module#...
...ate_method_defined?, Module#protected_method_defined?

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

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

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

...ndMethod を返します。

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

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

@see Module#public_instance_method, Object#method

//emlist[例][ruby]{
class Interpreter
d
ef d...
...int "there, "; end
d
ef do_d() print "Hello "; end
d
ef do_e() print "!\n"; end
d
ef do_v() print "Dave"; end
D
ispatcher = {
"a" => instance_method(:do_a),
"d" => instance_method(:do_d),
"e" => instance_method(:do_e),
"v" => instance_method(:do_v)
}
d
ef interpret(str...
...ing)
string.each_char {|b| Dispatcher[b].bind(self).call }
end
end

interpreter = Interpreter.new
interpreter.interpret('dave')
# => Hello there, Dave!
//}...

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

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

...ring または Symbol を指定します。

@param method Proc、Method あるいは UnboundMethod
いずれかのインスタンスを指定します。

@return メソッド名を表す Symbol を返します。

@raise TypeError method に同じクラス、サブクラス、モジュ...
...ール以外のメソッ
ドを指定した場合に発生します。

//emlist[例][ruby]{
class Foo
d
ef foo() p :foo end
d
efine_method(:bar, instance_method(:foo))
end
Foo.new.bar # => :foo
//}...

Module#public_instance_method(name) -> UnboundMethod (12333.0)

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

...スメソッド name をオブジェクト化した UnboundMethod を返します。

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

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

//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 (12311.0)

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

...や include したモジュールで
定義されたメソッドも対象になります。

@see Module#method_defined?, Module#public_method_defined?, Module#protected_method_defined?

//emlist[例][ruby]{
module
A
d
ef method1() end
end
class B
private
d
ef method2() end
end
class C...
...B
include A
d
ef 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#public_method_defined?(name, inherit=true) -> bool (12311.0)

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

...include したモジュールで
定義されたメソッドも対象になります。

@see Module#method_defined?, Module#private_method_defined?, Module#protected_method_defined?

//emlist[例][ruby]{
module
A
d
ef method1() end
end
class B
protected
d
ef method2() end
end
class C...
...de A
d
ef 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#protected_instance_methods(inherited_too = true) -> [Symbol] (12302.0)

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

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

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


@see Object#protected_methods, Module#instance_methods...

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

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

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

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

@pa...
...ド名が Symbol で渡されます。

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

d
ef foo
end
d
ef bar
end

undef_method :foo
undef bar
end
//}

実行結果:

method
C#foo was undefined
method
C#bar was undefined...
<< 1 2 3 ... > >>