Sha256: 0ba9f68d175650708a34a8d14b9d9e732eebd6b32ccf1b8069fbdc94ef2f953f
Contents?: true
Size: 628 Bytes
Versions: 13
Compression:
Stored size: 628 Bytes
Contents
module DuckPuncher # @note When updating this file please update comment regarding this module in duck_puncher.rb module Utilities def lookup_constant(const) return const if ::Module === const if const.to_s.respond_to?(:constantize) const.to_s.constantize else const.to_s.split('::').inject(::Object) { |k, part| k.const_get(part) } end rescue ::NameError => e logger.error "#{e.class}: #{e.message}" nil end def redefine_constant(name, const) if const_defined? name remove_const name end const_set name, const end end end
Version data entries
13 entries across 13 versions & 1 rubygems