408件ヒット
[201-300件を表示]
(0.100秒)
キーワード
- attr (12)
-
attr
_ accessor (4) -
attr
_ reader (4) -
attr
_ writer (4) - autoload (12)
-
class
_ variable _ defined? (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) -
const
_ defined? (12) -
const
_ get (12) -
const
_ source _ location (12) -
define
_ method (24) - inspect (12)
-
instance
_ method (12) -
method
_ defined? (12) - name (12)
- private (48)
-
private
_ class _ method (24) -
private
_ constant (12) -
private
_ method _ defined? (12) -
protected
_ method _ defined? (12) -
public
_ class _ method (24) -
public
_ constant (12) -
public
_ method _ defined? (12) -
rake
_ extension (12) -
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ method (12) -
to
_ s (12) -
undef
_ method (12)
検索結果
先頭5件
-
Module
# instance _ method(name) -> UnboundMethod (26.0) -
self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
...@param name メソッド名を Symbol または String で指定します。
@raise NameError self に存在しないメソッドを指定した場合に発生します。
@see Module#public_instance_method, Object#method
//emlist[例][ruby]{
class Interpreter
def do_a() print "there, "; end......e_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 }
end
end
interpreter = Interpreter.new
interpreter.interpret('dave')
# => Hello there, Dave... -
Module
# private() -> nil (21.0) -
メソッドを private に設定します。
...param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。
@raise NameError 存在しないメソッド名を指定した場合に発生します。
//emlist[例][ruby]{
class Foo
def foo1() 1 end... -
Module
# private(*name) -> Array (21.0) -
メソッドを private に設定します。
...param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。
@raise NameError 存在しないメソッド名を指定した場合に発生します。
//emlist[例][ruby]{
class Foo
def foo1() 1 end... -
Module
# private(names) -> Array (21.0) -
メソッドを private に設定します。
...param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。
@raise NameError 存在しないメソッド名を指定した場合に発生します。
//emlist[例][ruby]{
class Foo
def foo1() 1 end... -
Module
# const _ defined?(name , inherit = true) -> bool (20.0) -
モジュールに name で指定される名前の定数が定義されている時真 を返します。
...ができます。
@param name String, Symbol で指定される定数名。
@param inherit false を指定するとスーパークラスや include したモジュールで
定義された定数は対象にはなりません。
//emlist[例][ruby]{
module Kernel
FOO = 1
end
# Object......しても
# true を返す
p Object.const_defined?(:FOO) # => true
module Bar
BAR = 1
end
class Object
include Bar
end
# ユーザ定義のモジュールに対しても同様
p Object.const_defined?(:BAR) # => true
class Baz
include Bar
end
# Object 以外でも同様になった
# 第... -
Module
# method _ defined?(name , inherit=true) -> bool (20.0) -
モジュールにインスタンスメソッド name が定義されており、 かつその可視性が public または protected であるときに true を返します。
...aram name Symbol か String を指定します。
@param inherit 真を指定するとスーパークラスや include したモジュールで
定義されたメソッドも対象になります。
@see Module#public_method_defined?, Module#private_method_defined?, Module#protected_method_d......efined?
//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
end
class C < B
include A
def method3() end
end
A.method_defined? :method1... -
Module
# private _ constant(*name) -> self (20.0) -
name で指定した定数の可視性を private に変更します。
...上の String か Symbol を指定します。
@raise NameError 存在しない定数を指定した場合に発生します。
@return self を返します。
@see Module#public_constant, Object#untrusted?
//emlist[例][ruby]{
module Foo
BAR = 'bar'
class Baz; end
QUX = 'qux'
class Quux......0 個以上の String か Symbol を指定します。
@raise NameError 存在しない定数を指定した場合に発生します。
@return self を返します。
@see Module#public_constant
//emlist[例][ruby]{
module Foo
BAR = 'bar'
class Baz; end
QUX = 'qux'
class Quux; end
p... -
Module
# private _ method _ defined?(name , inherit=true) -> bool (20.0) -
インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が private であるときに true を返します。 そうでなければ false を返します。
...@param name Symbol か String を指定します。
@param inherit 真を指定するとスーパークラスや include したモジュールで
定義されたメソッドも対象になります。
@see Module#method_defined?, Module#public_method_defined?, Module#protected_method_defin......ed?
//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"... -
Module
# protected _ method _ defined?(name , inherit=true) -> bool (20.0) -
インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が 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
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...