lib/sugar-high/class_ext.rb in sugar-high-0.4.6.4 vs lib/sugar-high/class_ext.rb in sugar-high-0.4.7
- old
+ new
@@ -3,11 +3,11 @@
class Class
def include_and_extend(the_module, options={})
options[:instance_methods] ||= :InstanceMethods
options[:class_methods] ||= :ClassMethods
# Mainly include but be flexible
- main_module = const_get(the_module)
+ main_module = const_get(the_module.to_s.to_sym)
include main_module # for an extend_and_include method, change this to extend main_module
include main_module.const_get(options[:instance_methods]) if main_module.const_defined?(options[:instance_methods])
extend main_module.const_get(options[:class_methods]) if main_module.const_defined?(options[:class_methods])
end
end
@@ -82,6 +82,6 @@
res
end
raise "Not one Module for any of: #{names} is currently loaded" if modules.empty?
modules.first
end
-end
\ No newline at end of file
+end