Last Updated: February 25, 2016
·
3.137K
· siefca

Check if module exists in Ruby

def module_exists?(name, base = self.class)
   base.const_defined?(name) &&
  base.const_get(name).instance_of?(::Module)
end