Module: CopyTunerClient::HelperExtension

Defined in:
lib/copy_tuner_client/helper_extension.rb

Overview

ActionView の translate/t を alias_method で差し替え、Copyray のオーバーレイマーカーを注入する

Class Method Summary collapse

Class Method Details

.hook_translation_helper(mod, middleware_enabled:) ⇒ Object



61
62
63
64
65
66
67
68
69
70
# File 'lib/copy_tuner_client/helper_extension.rb', line 61

def self.hook_translation_helper(mod, middleware_enabled:)
  return unless middleware_enabled

  mod.include(CopyrayCommentInjection)
  mod.class_eval do
    alias_method :translate_without_copyray_comment, :translate
    alias_method :translate, :translate_with_copyray_comment
    alias_method :t, :translate
  end
end