- # fix for module names that are not constant names
- def bound_targets(klass) # :nodoc:
- ret = []
- ary = klass.name.split(/::/)
- while(v = ary.shift)
- begin
- ret.unshift(((ret.size == 0) ?
- Object.const_get(v) : ret[0].const_get(v)))
- rescue NameError
- # when an anonymous module is encountered, only the previous modules
- # are returned
- break
- end
+ if !instance_methods.include?('orig_bound_targets')
+ alias :orig_bound_targets :bound_targets
+ end
+ def bound_targets(*a) # :nodoc:
+ bt = orig_bound_targets(*a) rescue []
+ bt.empty? ? orig_bound_targets(Object) : bt
+ end
+
+ require 'stringio'
+
+ # This method is used to output debug information on the GetText
+ # textdomain, and it's called by the language setting routines
+ # in rbot
+ def rbot_gettext_debug
+ begin
+ gettext_info = StringIO.new
+ current_textdomain_info(:out => gettext_info) # fails sometimes
+ rescue Exception
+ warning "gettext failed to set call textdomain info. maybe an mo file doesn't exist for your locale."
+ ensure
+ gettext_info.string.each_line { |l| debug l}