416件ヒット
[1-100件を表示]
(0.089秒)
ライブラリ
- ビルトイン (120)
-
irb
/ context (11) -
irb
/ inspector (11) -
irb
/ output-method (22) -
minitest
/ unit (1) -
net
/ smtp (11) - optparse (11)
- ostruct (22)
- pp (33)
-
shell
/ filter (6) - win32ole (11)
クラス
-
IRB
:: Context (11) -
IRB
:: Inspector (11) -
IRB
:: OutputMethod (22) - Method (22)
-
Net
:: SMTP (11) - Object (55)
- OpenStruct (22)
-
OptionParser
:: ParseError (11) -
Shell
:: Filter (6) - String (11)
- Thread (11)
- UnboundMethod (10)
-
WIN32OLE
_ TYPE (11)
モジュール
- Kernel (33)
-
MiniTest
:: Assertions (1)
キーワード
- % (11)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (5) - Thread (11)
- [] (11)
-
bind
_ call (10) -
def
_ inspector (11) - format (11)
-
initialize
_ copy (11) - inspect (72)
- irb (11)
-
irb
/ completion (11) -
irb
/ ext / math-mode (4) -
mu
_ pp (1) - pp (11)
- ppx (11)
-
pretty
_ inspect (11) -
pretty
_ print (11) -
pretty
_ print _ inspect (11) -
rb
_ obj _ inspect (11) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 feature (11) - sprintf (11)
- sprintf フォーマット (11)
-
to
_ s (22) - クラス/メソッドの定義 (11)
- スレッド (11)
検索結果
先頭5件
-
Object
# inspect -> String (39131.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... -
Object
# pretty _ print _ inspect -> String (27161.0) -
Object#pretty_print を使って Object#inspect と同様に オブジェクトを人間が読める形式に変換した文字列を返します。
...
Object#pretty_print を使って Object#inspect と同様に
オブジェクトを人間が読める形式に変換した文字列を返します。
出力する全てのオブジェクトに Object#pretty_print が定義されている必要があります。
そうでない場合には RuntimeEr......ror が発生します。
@raise RuntimeError 出力する全てのオブジェクトに Object#pretty_print が定義されて
いない場合に発生します。... -
Object
# pretty _ inspect -> String (27101.0) -
self を pp で表示したときの結果を文字列として返します。
...self を pp で表示したときの結果を文字列として返します。... -
Object
# initialize _ copy(obj) -> object (21167.0) -
(拡張ライブラリによる) ユーザ定義クラスのオブジェクトコピーの初期化メソッド。
...置き換えます。ただ
し、self のインスタンス変数や特異メソッドは変化しません。
Object#clone, Object#dupの内部で使われています。
initialize_copy は、Ruby インタプリタが知り得ない情報をコピーするた
めに使用(定義)されます。......lize_copy でコピーするよう定義しておくことで、dup や clone
を再定義する必要がなくなります。
デフォルトの Object#initialize_copy は、 freeze チェックおよび型のチェックを行い self
を返すだけのメソッドです。
initialize_copy と......のメソッドは
自動的に private に設定されます。
@raise TypeError レシーバが freeze されているか、obj のクラスがレシーバ
のクラスと異なる場合に発生します。
@see Object#clone,Object#dup
以下に例として、dup や clone がこのメソッ... -
Object
# pretty _ print(pp) -> () (21018.0) -
PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに 呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。
...
PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに
呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。
あるクラスの pp の出力をカスタマイズしたい場合は、このメソッドを再定義します。
そのと...... pretty_print メソッドは指定された pp に対して表示したい自身の内容を追加して
いかなければいけません。いくつかの組み込みクラスについて、
pp ライブラリはあらかじめ pretty_print メソッドを定義しています。
@param 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......オブジェクトです。
//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... -
Net
:: SMTP # inspect -> String (18133.0) -
@see Object#inspect
...@see Object#inspect... -
Method
# inspect -> String (18131.0) -
self を読みやすい文字列として返します。
...式の文字列を返します。
#<Method: klass1(klass2)#method> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。
klass2......します。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar
end
end
p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo>
p Bar.new.method(:bar) # => #<Method: Bar#bar>
//}
klass1 と klass2 が同じ場合は以下の形式になり......bj
def foo
end
end
p obj.method(:foo) # => #<Method: "".foo>
# クラスメソッド(クラスの特異メソッド)
class Foo
def Foo.foo
end
end
p Foo.method(:foo) # => #<Method: Foo.foo>
# スーパークラスのクラスメソッド
class Bar < Foo
end
p Bar.method(:foo)......の文字列を返します。
#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。
klass2......//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar(a, b)
end
end
p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo() test.rb:2>
p Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
//}
klass1 と klass2 が同じ場合は以......end
end
p obj.method(:foo) # => #<Method: "".foo() foo.rb:4>
# クラスメソッド(クラスの特異メソッド)
class Foo
def Foo.foo
end
end
p Foo.method(:foo) # => #<Method: Foo.foo() foo.rb:11>
# スーパークラスのクラスメソッド
class Bar < Foo
end
p Bar.metho... -
OpenStruct
# inspect -> String (18113.0) -
オブジェクトを人間が読める形式に変換した文字列を返します。
...オブジェクトを人間が読める形式に変換した文字列を返します。
@see Object#inspect... -
OptionParser
:: ParseError # inspect -> String (18113.0) -
自身を人間が読みやすい形の文字列表現にして返します。
...自身を人間が読みやすい形の文字列表現にして返します。
@return 文字列を返します。
@see Object#inspect... -
Shell
:: Filter # inspect -> String (18113.0) -
オブジェクトを人間が読める形式に変換した文字列を返します。
...オブジェクトを人間が読める形式に変換した文字列を返します。
@see Object#inspect...