lib/spiderfw/utils/monkey/module.rb in spiderfw-0.5.19 vs lib/spiderfw/utils/monkey/module.rb in spiderfw-0.6.0
- old
+ new
@@ -4,10 +4,12 @@
def subclass_of?(klass)
return false
end
def parent_module(n=1)
- return const_get_full(self.to_s.reverse.split('::', n+1)[n].reverse)
+ part = self.to_s.reverse.split('::', n+1)[n]
+ return nil if part.blank?
+ return const_get_full(part.reverse)
end
def last_name
self.to_s.split('::')[-1].to_sym
end
\ No newline at end of file