133件ヒット
[1-100件を表示]
(0.142秒)
ライブラリ
- ビルトイン (77)
-
minitest
/ spec (1) - pp (33)
- psych (22)
キーワード
- inspect (11)
-
instance
_ of? (11) -
instance
_ variable _ defined? (11) -
instance
_ variable _ get (11) -
instance
_ variable _ set (11) -
instance
_ variables (11) -
must
_ be _ instance _ of (1) -
pretty
_ inspect (11) -
pretty
_ print _ inspect (11) -
pretty
_ print _ instance _ variables (11) -
psych
_ to _ yaml (11) -
remove
_ instance _ variable (11) -
to
_ yaml (11)
検索結果
先頭5件
-
Object
# pretty _ print _ inspect -> String (18401.0) -
Object#pretty_print を使って Object#inspect と同様に オブジェクトを人間が読める形式に変換した文字列を返します。
...
Object#pretty_print を使って Object#inspect と同様に
オブジェクトを人間が読める形式に変換した文字列を返します。
出力する全てのオブジェクトに Object#pretty_print が定義されている必要があります。
そうでない場合には RuntimeEr......ror が発生します。
@raise RuntimeError 出力する全てのオブジェクトに Object#pretty_print が定義されて
いない場合に発生します。... -
Object
# pretty _ print _ instance _ variables -> [String | Symbol] (18401.0) -
プリティプリント時に表示すべき自身のインスタンス変数名の配列をソートして返します。 返されたインスタンス変数はプリティプリント時に表示されます。
プリティプリント時に表示すべき自身のインスタンス変数名の配列をソートして返します。
返されたインスタンス変数はプリティプリント時に表示されます。
pp に表示したくないインスタンス変数がある場合にこのメソッドを再定義します。 -
Object
# instance _ variable _ defined?(var) -> bool (18301.0) -
インスタンス変数 var が定義されていたら真を返します。
...//emlist[][ruby]{
class Fred
def initialize(p1, p2)
@a, @b = p1, p2
end
end
fred = Fred.new('cat', 99)
p fred.instance_variable_defined?(:@a) #=> true
p fred.instance_variable_defined?("@b") #=> true
p fred.instance_variable_defined?("@c") #=> false
//}
@see Object#instance_variable_......get,Object#instance_variable_set,Object#instance_variables... -
Object
# inspect -> String (12301.0) -
オブジェクトを人間が読める形式に変換した文字列を返します。
...ドの結果を使用して
オブジェクトを表示します。
//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 _ inspect -> String (12301.0) -
self を pp で表示したときの結果を文字列として返します。
self を pp で表示したときの結果を文字列として返します。 -
Object
# instance _ of?(klass) -> bool (12201.0) -
オブジェクトがクラス klass の直接のインスタンスである時真を返します。
...す。
obj.instance_of?(c) が成立する時には、常に obj.kind_of?(c) も成立します。
@param klass Classかそのサブクラスのインスタンスです。
//emlist[][ruby]{
class C < Object
end
class S < C
end
obj = S.new
p obj.instance_of?(S) # true
p obj.instance_of?(C)......# false
//}
@see Object#kind_of?,Object#class... -
Object
# instance _ variable _ get(var) -> object | nil (12201.0) -
オブジェクトのインスタンス変数の値を取得して返します。
...ば nil を返します。
@param var インスタンス変数名を文字列か Symbol で指定します。
//emlist[][ruby]{
class Foo
def initialize
@foo = 1
end
end
obj = Foo.new
p obj.instance_variable_get("@foo") #=> 1
p obj.instance_variable_get(:@foo) #=> 1
p obj.instanc......e_variable_get(:@bar) #=> nil
//}
@see Object#instance_variable_set,Object#instance_variables,Object#instance_variable_defined?... -
Object
# instance _ variable _ set(var , value) -> object (12201.0) -
オブジェクトのインスタンス変数 var に値 value を設定します。
...value を返します。
//emlist[][ruby]{
obj = Object.new
p obj.instance_variable_set("@foo", 1) #=> 1
p obj.instance_variable_set(:@foo, 2) #=> 2
p obj.instance_variable_get(:@foo) #=> 2
//}
@see Object#instance_variable_get,Object#instance_variables,Object#instance_variable_defined?... -
Object
# instance _ variables -> [Symbol] (12201.0) -
オブジェクトのインスタンス変数名をシンボルの配列として返します。
...列として返します。
//emlist[][ruby]{
obj = Object.new
obj.instance_eval { @foo, @bar = nil }
p obj.instance_variables
#=> [:@foo, :@bar]
//}
@see Object#instance_variable_get, Kernel.#local_variables, Kernel.#global_variables, Module.constants, Module#constants, Module#class_variables... -
Object
# must _ be _ instance _ of(klass) -> true (12201.0) -
自身が与えられたクラスのインスタンスである場合、検査にパスしたことになります。
...ンスである場合、検査にパスしたことになります。
@param klass 任意のクラスを指定します。
@raise MiniTest::Assertion 自身が与えられたクラスの直接のインスタンスでない場合に発生します。
@see MiniTest::Assertions#assert_instance_of...