4件ヒット
[1-4件を表示]
(0.070秒)
キーワード
- eql? (1)
- equal? (1)
-
pretty
_ print (1) -
pretty
_ print _ cycle (1)
検索結果
先頭4件
-
Object
# eql?(other) -> bool (18307.0) -
オブジェクトと other が等しければ真を返します。Hash で二つのキー が等しいかどうかを判定するのに使われます。
... Object#hash メソッ
ドも再定義しなければなりません。
@param other 比較するオブジェクトです。
//emlist[][ruby]{
p("foo".eql?("bar")) #=> false
p("foo".eql?("foo")) #=> true
p(4.eql?(4)) #=> true
p(4.eql?(4.0)) #=> false
//}
@see Object#hash,Object#equal?,Object#==... -
Object
# equal?(other) -> bool (18307.0) -
other が self 自身の時、真を返します。
...Object#object_idが一致する
かどうかを調べます。
@param other 比較するオブジェクトです。
//emlist[][ruby]{
p("foo".equal?("bar")) #=> false
p("foo".equal?("foo")) #=> false
p(4.equal?(4)) #=> true
p(4.equal?(4.0)) #=> false
p(:foo.equal? :foo) #=> true
//}
@see Object......#object_id,Object#==,Object#eql?,Symbol... -
Object
# pretty _ print(pp) -> () (79.0) -
PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに 呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。
...ブジェクトです。
//emlist[][ruby]{
require 'pp'
class Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
end
//}
@see Object#pretty_print_cycle, Object#inspect, PrettyPrint#text, PrettyPrint#group, PrettyPrint#breakable... -
Object
# pretty _ print _ cycle(pp) -> () (43.0) -
プリティプリント時にオブジェクトの循環参照が検出された場合、 Object#pretty_print の代わりに呼ばれるメソッドです。
...プリティプリント時にオブジェクトの循環参照が検出された場合、
Object#pretty_print の代わりに呼ばれるメソッドです。
あるクラスの pp の出力をカスタマイズしたい場合は、
このメソッドも再定義する必要があります。
@p......aram pp PP オブジェクトです。
//emlist[][ruby]{
class Array
def pretty_print_cycle(q)
q.text(empty? ? '[]' : '[...]')
end
end
//}
@see Object#pretty_print...