While older ruby-gettext raised when trying to bind for anonymous
modules (such as the ones that wrap rbot plugins), newer versions just
provide an empty array. This makes the previous fix (which used rescue)
ineffective.
Solve by rescuing with [] (so that older gettext behaves like the new
one) and then adding Object if the list is indeed empty.
alias :orig_bound_targets :bound_targets
end
def bound_targets(*a) # :nodoc:
- orig_bound_targets(*a) rescue orig_bound_targets(Object)
+ bt = orig_bound_targets(*a) rescue []
+ bt.empty? ? orig_bound_targets(Object) : bt
end
require 'stringio'