lib/sugar-high/class_ext.rb in sugar-high-0.4.6 vs lib/sugar-high/class_ext.rb in sugar-high-0.4.6.1
- old
+ new
@@ -13,11 +13,11 @@
end
module ClassExt
def get_module name
# Module.const_get(name)
- name.to_s.constantize
+ name.to_s.camelize.constantize
rescue
nil
end
def is_class?(clazz)
@@ -75,10 +75,10 @@
classes.first
end
def find_first_module *names
modules = names.flatten.compact.uniq.inject([]) do |res, class_name|
- found_class = try_class(class_name.to_s.camelize)
+ found_class = try_module(class_name.to_s.camelize)
res << found_class if found_class
res
end
raise "Not one Module for any of: #{names} is currently loaded" if modules.empty?
modules.first
\ No newline at end of file