るりまサーチ

最速Rubyリファレンスマニュアル検索!
121件ヒット [1-100件を表示] (0.014秒)
トップページ > クエリ:ins[x] > クラス:Object[x]

別のキーワード

  1. streamui ins
  2. rubygems/user_interaction ins
  3. ins_methods_i
  4. ins gem::streamui

検索結果

<< 1 2 > >>

Object#inspect -> String (6101.0)

オブジェクトを人間が読める形式に変換した文字列を返します。

...用して
オブジェクトを表示します。

//emlist[][ruby]{
[ 1, 2, 3..4, 'five' ].inspect # => "[1, 2, 3..4, \"five\"]"
Time.new.inspect # => "2008-03-08 19:43:39 +0900"
//}

ins
pect メソッドをオーバーライドしなかった場合、クラス名とインスタ...
...変数の名前、値の組を元にした文字列を返します。

//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#instance_of?(klass) -> bool (6101.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_defined?(var) -> bool (6101.0)

インスタンス変数 var が定義されていたら真を返します。

..., @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#instance_variable_get(var) -> object | nil (6101.0)

オブジェクトのインスタンス変数の値を取得して返します。

...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.instance_variable_get(:@bar) #=> nil
//}

@see Object#instance_variable_set,Object#instance_variables,Object#instance_variable_defined?...

Object#instance_variable_set(var, value) -> object (6101.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] (6101.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, Modu...

Object#must_be_instance_of(klass) -> true (6101.0)

自身が与えられたクラスのインスタンスである場合、検査にパスしたことになります。

...ンスである場合、検査にパスしたことになります。

@param klass 任意のクラスを指定します。

@raise MiniTest::Assertion 自身が与えられたクラスの直接のインスタンスでない場合に発生します。

@see MiniTest::Assertions#assert_instance_of...

Object#pretty_inspect -> String (6101.0)

self を pp で表示したときの結果を文字列として返します。

self を pp で表示したときの結果を文字列として返します。

Object#pretty_print_inspect -> String (6101.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] (6101.0)

プリティプリント時に表示すべき自身のインスタンス変数名の配列をソートして返します。 返されたインスタンス変数はプリティプリント時に表示されます。

プリティプリント時に表示すべき自身のインスタンス変数名の配列をソートして返します。
返されたインスタンス変数はプリティプリント時に表示されます。

pp に表示したくないインスタンス変数がある場合にこのメソッドを再定義します。

絞り込み条件を変える

<< 1 2 > >>