るりまサーチ

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

別のキーワード

  1. win32ole ole_methods
  2. win32ole ole_get_methods
  3. fileutils methods
  4. win32ole ole_put_methods
  5. win32ole ole_func_methods

ライブラリ

検索結果

Object#initialize_copy(obj) -> object (18174.0)

(拡張ライブラリによる) ユーザ定義クラスのオブジェクトコピーの初期化メソッド。

...置き換えます。ただ
し、self のインスタンス変数や特異メソッドは変化しません。
Object
#clone, Object#dupの内部で使われています。

initialize_copy
は、Ruby インタプリタが知り得ない情報をコピーするた
めに使用(定義)されます。...
...j = Object.new
class <<obj
attr_accessor :foo
def bar
:bar
end
end

def check(obj)
puts "instance variables: #{obj.inspect}"
puts "tainted?: #{obj.tainted?}"
print "singleton methods: "
begin
p obj.bar
rescue NameError
p $!
end
end

obj.foo = 1
obj.taint

check Object.n...
....send(:initialize_copy, obj)
#=> instance variables: #<Object:0x4019c9d4>
# tainted?: false
# singleton methods: #<NoMethodError: ...>
check obj.dup
#=> instance variables: #<Object:0x4019c9c0 @foo=1>
# tainted?: true
# singleton methods: #<NoM...