120件ヒット
[101-120件を表示]
(0.091秒)
別のキーワード
ライブラリ
- ビルトイン (120)
キーワード
-
instance
_ method (12) -
private
_ constant (12) -
public
_ class _ method (24) -
public
_ constant (12) -
public
_ instance _ method (12)
検索結果
-
Module
# private _ constant(*name) -> self (145.0) -
name で指定した定数の可視性を private に変更します。
...変更します。
@param name 0 個以上の String か Symbol を指定します。
@raise NameError 存在しない定数を指定した場合に発生します。
@return self を返します。
@see Module#public_constant, Object#untrusted?
//emlist[例][ruby]{
module Foo
BAR = 'bar'
c......private に変更します。
@param name 0 個以上の String か Symbol を指定します。
@raise NameError 存在しない定数を指定した場合に発生します。
@return self を返します。
@see Module#public_constant
//emlist[例][ruby]{
module Foo
BAR = 'bar'
class Ba... -
Module
# instance _ method(name) -> UnboundMethod (60.0) -
self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
...
self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError self に存在しないメソッドを指定した場合に発生します。
@see Module#publ......ic_instance_method, Object#method
//emlist[例][ruby]{
class Interpreter
def do_a() print "there, "; end
def do_d() print "Hello "; end
def do_e() 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 }
end
end
interpreter = Interpreter.new
interpreter.interpret('dave')
# => Hello there, Dave!
//}...