Sha256: 13ad1ceb5c3da7ac3521c5f47fd8ac2118fb3a0cf529b462fe287f70af2239a3

Contents?: true

Size: 376 Bytes

Versions: 1

Compression:

Stored size: 376 Bytes

Contents

class Object
  def define_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 redefine_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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
constant-redefinition-1.0.0 lib/constant-redefinition.rb