Sha256: a053feae2e990a7b9f11612af24d1071ba5c92228c8bd95bf5ea91096b667335
Contents?: true
Size: 321 Bytes
Versions: 2
Compression:
Stored size: 321 Bytes
Contents
class Bogus::OverwritesClasses def overwrite(klass, new_klass) modules = klass.name.split('::') klass_name = modules.pop parent_module = modules.reduce(Object) { |mod, name| mod.const_get(name) } parent_module.send(:remove_const, klass_name) parent_module.const_set(klass_name, new_klass) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bogus-0.0.2 | lib/bogus/overwrites_classes.rb |
bogus-0.0.1 | lib/bogus/overwrites_classes.rb |