Sha256: 7b31dba1ded58586e4191b910a6ad471ac4a1e72f400cb648ba3a2eee1100e78

Contents?: true

Size: 1.21 KB

Versions: 10

Compression:

Stored size: 1.21 KB

Contents

module HoptoadNotifier
  module Rails
    module JavascriptNotifier
      def self.included(base) #:nodoc:
        base.send :helper_method, :hoptoad_javascript_notifier
      end

      private

      def hoptoad_javascript_notifier
        return unless HoptoadNotifier.configuration.public?

        path = File.join File.dirname(__FILE__), '..', '..', 'templates', 'javascript_notifier.erb'
        host = HoptoadNotifier.configuration.host.dup
        port = HoptoadNotifier.configuration.port
        host << ":#{port}" unless [80, 443].include?(port)

        options              = {
          :file              => path,
          :layout            => false,
          :use_full_path     => false,
          :locals            => {
            :host            => host,
            :api_key         => HoptoadNotifier.configuration.api_key,
            :environment     => HoptoadNotifier.configuration.environment_name,
            :action_name     => action_name,
            :controller_name => controller_name,
            :url             => request.url
          }
        }

        if @template
          @template.render(options)
        else
          render_to_string(options)
        end

      end

    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
square-hoptoad_notifier-2.4.9 lib/hoptoad_notifier/rails/javascript_notifier.rb
hoptoad_notifier-2.4.11 lib/hoptoad_notifier/rails/javascript_notifier.rb
hoptoad_notifier-2.4.10 lib/hoptoad_notifier/rails/javascript_notifier.rb
hoptoad_notifier-2.4.9 lib/hoptoad_notifier/rails/javascript_notifier.rb
square-hoptoad_notifier-2.4.8 lib/hoptoad_notifier/rails/javascript_notifier.rb
hoptoad_notifier-2.4.8 lib/hoptoad_notifier/rails/javascript_notifier.rb
hoptoad_notifier-2.4.7 lib/hoptoad_notifier/rails/javascript_notifier.rb
hoptoad_notifier-2.4.6 lib/hoptoad_notifier/rails/javascript_notifier.rb
hoptoad_notifier-2.4.5 lib/hoptoad_notifier/rails/javascript_notifier.rb
hoptoad_notifier-2.4.4 lib/hoptoad_notifier/rails/javascript_notifier.rb