Sha256: 59c6f9f330310947881fc710328a8853b39ffed2f02dd0764150cce9934d9d66

Contents?: true

Size: 925 Bytes

Versions: 3

Compression:

Stored size: 925 Bytes

Contents

module Ads
  module Rails
    module Extensions
      module ActionView
        module Base
          extend ActiveSupport::Concern

          def google_adsense_include_tag(*args)
            options = args.extract_options!
            if ::Rails.env.production?
              variables = options.map do |key, value|
                "google_ad_#{key} = #{value.to_json};"
              end
              content_tag(
                :script,
                variables.join("\n").html_safe,
                type: 'text/javascript'
              ) +
              content_tag(
                :script,
                nil,
                type: 'text/javascript',
                src: "#{request.protocol}pagead2.googlesyndication.com/pagead/show_ads.js"
              )
            else
              instance_exec options, &Ads.configuration.sample_tag
            end
          end

        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ads-rails-5.1.0 lib/ads/rails/extensions/action_view/base.rb
ads-rails-4.0.0.1 lib/ads/rails/extensions/action_view/base.rb
ads-rails-4.0.0.0 lib/ads/rails/extensions/action_view/base.rb