Sha256: 57c91cb1aa73ca5eef13742afd921391d0176290dfe845da9a1825cc6d86a12f
Contents?: true
Size: 504 Bytes
Versions: 13
Compression:
Stored size: 504 Bytes
Contents
class Module def backup_const(name) redef_const(:TEMP_BACKUP, const_get(name)) end def restore_const(name) redef_const(name, const_get(:TEMP_BACKUP)) remove_const(:TEMP_BACKUP) end def redef_const(name, value) remove_const(name) if const_defined?(name) const_set(name, value) end def stub_const_and_test(const_name, const_value, &test_blk) backup_const(const_name) redef_const(const_name, const_value) test_blk.call restore_const(const_name) end end
Version data entries
13 entries across 13 versions & 1 rubygems