Sha256: 43f502bb4185bc1a11b6014780e1bcc9ddaffbf1025f609be91750523945c93e

Contents?: true

Size: 514 Bytes

Versions: 4

Compression:

Stored size: 514 Bytes

Contents

require_relative "base"

module Suspenders
  class AnalyticsGenerator < Generators::Base
    def install_partial
      copy_file "_analytics.html.erb",
        "app/views/application/_analytics.html.erb"
    end

    def render_partial
      if File.exist?(js_partial)
        inject_into_file js_partial,
          %(\n\n<%= render "analytics" %>),
          after: "<%= yield :javascript %>"
      end
    end

    private

    def js_partial
      "app/views/application/_javascript.html.erb"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
suspenders-20230113.0 lib/suspenders/generators/analytics_generator.rb
suspenders-1.56.1 lib/suspenders/generators/analytics_generator.rb
suspenders-1.55.1 lib/suspenders/generators/analytics_generator.rb
suspenders-1.55.0 lib/suspenders/generators/analytics_generator.rb