I want to put my gem monkey patches into e.g. /lib/gem_ext/i18n.rb:
module GemExt
module I18n
def self.translate(*args)
raise 'ok'
end
end
end
… and mixin into the gem through a Rails initializer gem_ext.rb.
I tried:
a) I18n.send :include, GemExt::I18n
b) I18n.send :include, GemExt::I18nExt
c) I18n.module_eval { include ::GemExt::I18n }
d) I18n.module_eval { include ::GemExt::I18nExt }
But after restarting the Rails console it doesn’t raise this exception on I18n.translate(“key”) but shows the original behaviour and newly declared methods raise an NoMethodError.
config/initializers/gem_ext.rb
lib/gem_ext/i18n.rb