288件ヒット
[1-100件を表示]
(0.039秒)
ライブラリ
- ビルトイン (252)
- forwardable (24)
- pp (12)
クラス
- Module (96)
- Object (72)
- UnboundMethod (96)
モジュール
- Forwardable (24)
キーワード
- == (12)
- === (24)
- arity (12)
- class (12)
- clone (12)
-
define
_ method (24) - delegate (12)
- eql? (12)
- inspect (12)
-
instance
_ delegate (12) -
instance
_ method (12) - method (12)
- name (12)
-
pretty
_ print _ instance _ variables (12) -
public
_ instance _ method (12) -
public
_ method (12) -
remove
_ class _ variable (12) -
remove
_ const (12) -
singleton
_ method (12) -
source
_ location (12) -
to
_ s (12) -
undef
_ method (12)
検索結果
先頭5件
-
Object
# pretty _ print _ instance _ variables -> [String | Symbol] (6203.0) -
プリティプリント時に表示すべき自身のインスタンス変数名の配列をソートして返します。 返されたインスタンス変数はプリティプリント時に表示されます。
プリティプリント時に表示すべき自身のインスタンス変数名の配列をソートして返します。
返されたインスタンス変数はプリティプリント時に表示されます。
pp に表示したくないインスタンス変数がある場合にこのメソッドを再定義します。 -
Module
# instance _ method(name) -> UnboundMethod (6150.0) -
self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
...ethod を返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError self に存在しないメソッドを指定した場合に発生します。
@see Module#public_instance_method, Object#method
//emlist[例][ruby]{
class Interpreter
def do_a......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
interpr... -
Module
# public _ instance _ method(name) -> UnboundMethod (6126.0) -
self の public インスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
...ド名を Symbol または String で指定します。
@raise NameError 定義されていないメソッド名や、
protected メソッド名、 private メソッド名を引数として与えると発生します。
//emlist[例][ruby]{
Kernel.public_instance_method(:object_id) #=> #<Un......boundMethod: Kernel#object_id>
Kernel.public_instance_method(:p) # method `p' for module `Kernel' is private (NameError)
//}
@see Module#instance_method,Object#public_method... -
Forwardable
# instance _ delegate(hash) -> () (3108.0) -
メソッドの委譲先を設定します。
...am hash 委譲先のメソッドがキー、委譲先のオブジェクトが値の
Hash を指定します。キーは Symbol、
String かその配列で指定します。
例:
require 'forwardable'
class Zap
extend Forwardable
delegate :length => :@str... -
UnboundMethod
# inspect -> String (121.0) -
self を読みやすい文字列として返します。
...self を読みやすい文字列として返します。
詳しくは Method#inspect を参照してください。
//emlist[例][ruby]{
String.instance_method(:count).inspect # => "#<UnboundMethod: String#count>"
//}
@see Method#inspect... -
UnboundMethod
# to _ s -> String (121.0) -
self を読みやすい文字列として返します。
...self を読みやすい文字列として返します。
詳しくは Method#inspect を参照してください。
//emlist[例][ruby]{
String.instance_method(:count).inspect # => "#<UnboundMethod: String#count>"
//}
@see Method#inspect... -
UnboundMethod
# source _ location -> [String , Integer] | nil (114.0) -
ソースコードのファイル名と行番号を配列で返します。
...い(つまりネイティブ
である)場合は nil を返します。
//emlist[例][ruby]{
require 'time'
Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2.4.0/time.rb", 654]
//}
@see... -
UnboundMethod
# arity -> Integer (85.0) -
メソッドが受け付ける引数の数を返します。
...); end
end
p C.instance_method(:one).arity #=> 0
p C.instance_method(:two).arity #=> 1
p C.instance_method(:three).arity #=> -1
p C.instance_method(:four).arity #=> 2
p C.instance_method(:five).arity #=> -3
p C.instance_method(:six).arity #=> -3
String.instance_method(:size).a......rity #=> 0
String.instance_method(:replace).arity #=> 1
String.instance_method(:squeeze).arity #=> -1
String.instance_method(:count).arity #=> -1
//}... -
Module
# undef _ method(*name) -> self (37.0) -
このモジュールのインスタンスメソッド name を未定義にします。
...このモジュールのインスタンスメソッド name を未定義にします。
@param name 0 個以上の String か Symbol を指定します。
@raise NameError 指定したインスタンスメソッドが定義されていない場合に発生します。
=== 「未定義にする......undef_method の違いは、
メソッド名を String または Symbol で与えられることです。
//emlist[例][ruby]{
module M1
def foo
end
def self.moo
undef foo
end
end
M1.instance_methods false #=> ["foo"]
M1.moo
M1.instance_methods false #=> []
module M2
def foo
end......def self.moo
undef_method :foo
end
end
M2.instance_methods false #=> ["foo"]
M2.moo
M2.instance_methods false #=> []
//}...