diff options
author | Dmitry Kim <dmitry point kim at gmail point com> | 2007-07-12 16:23:58 +0000 |
---|---|---|
committer | Dmitry Kim <dmitry point kim at gmail point com> | 2007-07-12 16:23:58 +0000 |
commit | d68e6d145a677f0ea9a3219d711f58c5edff9d6e (patch) | |
tree | eb33464225ddfd5002316592832f2c1585340a74 /lib/rbot | |
parent | 7954bec2bbf4ba75c05412a98a9265a33d891b13 (diff) |
* (gettext) make us somewhat less dependent on gettext internals
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/load-gettext.rb | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/rbot/load-gettext.rb b/lib/rbot/load-gettext.rb index 4c18892d..165a81c5 100644 --- a/lib/rbot/load-gettext.rb +++ b/lib/rbot/load-gettext.rb @@ -12,20 +12,11 @@ begin # patch for ruby-gettext 1.9.0 to cope with anonymous modules used by rbot # FIXME remove the patch when ruby-gettext is fixed, or rbot switches to named modules # 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 - end - ((ret + klass.ancestors + [GetText]) & @@__textdomainmanagers.keys).uniq + if !instance_methods.include?('orig_bound_targets') + alias :orig_bound_targets :bound_targets + end + def bound_targets(*a) # :nodoc: + orig_bound_targets(*a) rescue orig_bound_targets(Object) end end |