Sha256: de4bbcc9e58aee947516c0cae9455617dac7c21ad48b01f2f3af2a0bce8d54b5

Contents?: true

Size: 213 Bytes

Versions: 2

Compression:

Stored size: 213 Bytes

Contents

def redefine_constant(const, value)
  orig = eval(const).dup

  Object.send(:remove_const, const)
  Object.const_set(const, value)

  yield

  Object.send(:remove_const, const)
  Object.const_set(const, orig)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mojikun-1.0.1 test/test_helper.rb
mojikun-1.0.0 test/test_helper.rb