Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Object
- def def_if_not_defined(const, value)
- mod = self.is_a?(Module) ? self : self.class
- mod.const_set(const, value) unless mod.const_defined?(const)
- end
- def redef_without_warning(const, value)
- mod = self.is_a?(Module) ? self : self.class
- mod.send(:remove_const, const) if mod.const_defined?(const)
- mod.const_set(const, value)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement