43件ヒット
[1-43件を表示]
(0.025秒)
クラス
- Object (22)
- String (11)
- UnboundMethod (10)
キーワード
- % (11)
-
bind
_ call (10) -
pretty
_ print (11)
検索結果
先頭5件
-
Object
# inspect -> String (18144.0) -
オブジェクトを人間が読める形式に変換した文字列を返します。
...組み込み関数 Kernel.#p は、このメソッドの結果を使用して
オブジェクトを表示します。
//emlist[][ruby]{
[ 1, 2, 3..4, 'five' ].inspect # => "[1, 2, 3..4, \"five\"]"
Time.new.inspect # => "2008-03-08 19:43:39 +0900"
//}
inspect メソッドをオ......変数の名前、値の組を元にした文字列を返します。
//emlist[][ruby]{
class Foo
end
Foo.new.inspect # => "#<Foo:0x0300c868>"
class Bar
def initialize
@bar = 1
end
end
Bar.new.inspect # => "#<Bar:0x0300c868 @bar=1>"
//}
@see Kernel.#p... -
String
# %(args) -> String (25.0) -
printf と同じ規則に従って args をフォーマットします。
...printf と同じ規則に従って args をフォーマットします。
args が配列であれば Kernel.#sprintf(self, *args) と同じです。
それ以外の場合は Kernel.#sprintf(self, args) と同じです。
@param args フォーマットする値、もしくはその配列
@retu......す。
: p
Object#inspect の結果を出力します。
//emlist[][ruby]{
p sprintf("%s", /e+/) #=> "(?-mix:e+)"
p sprintf("%p", /e+/) #=> "/e+/"
//}
: d
: i
引数の数値を10進表現の整数として出力します。
引数が整数でなければ関数 Kernel.#Integer と同じ... -
Object
# pretty _ print(pp) -> () (23.0) -
PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに 呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。
...PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに
呼ばれるメソッドです。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......@param pp PP オブジェクトです。
//emlist[][ruby]{
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... -
UnboundMethod
# bind _ call(recv , *args) -> object (13.0) -
self を recv に bind して args を引数として呼び出します。
...self を recv に bind して args を引数として呼び出します。
self.bind(recv).call(*args) と同じ意味です。
//emlist[][ruby]{
puts Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}
@see UnboundMethod#bind, Method#call... -
UnboundMethod
# bind _ call(recv , *args) { . . . } -> object (13.0) -
self を recv に bind して args を引数として呼び出します。
...self を recv に bind して args を引数として呼び出します。
self.bind(recv).call(*args) と同じ意味です。
//emlist[][ruby]{
puts Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}
@see UnboundMethod#bind, Method#call...