24件ヒット
[1-24件を表示]
(0.014秒)
別のキーワード
キーワード
- Marshal フォーマット (12)
- Ruby プログラムの実行 (12)
検索結果
-
Marshal フォーマット (25.0)
-
Marshal フォーマット フォーマットバージョン 4.8 を元に記述しています。
...tance_eval { @bar } # => 1
File.open('testfile', 'wb') do |f|
Marshal.dump(Bar, f)
end
# 別プログラム相当にするため remove_const
Object.send :remove_const, :Bar
module Bar
end
p bar = Marshal.load(File.binread('testfile'))
p bar.instance_eval { @bar }
# => nil
//}
//emlist[例 3:......end
end
p Baz.baz
# => 1
File.open('testfile', 'wb') do |f|
Marshal.dump(Baz, f)
end
# 別プログラム相当にするため remove_const
Object.send :remove_const, :Baz
module Baz
def self.baz
@@baz
end
end
p baz = Marshal.load(File.binread('testfile'))
# => Baz
baz.baz
# => uniniti... -
Ruby プログラムの実行 (7.0)
-
Ruby プログラムの実行 === Ruby プログラム
...の class です。また非常に特殊な例外としてメソッド
Module#const_set によっても定義が可能です。さらに
Module#remove_const を使うことで定義の取り消しが可能です。
すでに定義されている定数の再定義および代入はできません。...