Module: SibaTest::RemovableConstants

Defined in:
lib/siba/helpers/test/removable_constants.rb

Class Method Summary collapse

Class Method Details

.def_if_not_defined(cls, const, value) ⇒ Object



8
9
10
# File 'lib/siba/helpers/test/removable_constants.rb', line 8

def def_if_not_defined(cls, const, value)
  cls.const_set(const, value) unless cls.const_defined?(const)
end

.redef_without_warning(cls, const, value) ⇒ Object



12
13
14
15
# File 'lib/siba/helpers/test/removable_constants.rb', line 12

def redef_without_warning(cls, const, value)
  cls.send(:remove_const, const) if cls.const_defined?(const)
  cls.const_set(const, value)
end