Sha256: edbcc47fc9ee3513f843ec3e7f1cd92458b5cf75c52738842a9d9a8f625fc19d

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

module Juggernaut # :nodoc:
  module Rails
    module Helpers

      def juggernaut(options = {}, include_tag = true)
        options = juggernaut_options(options)
        if include_tag
          javascript_tag "new Juggernaut(#{options.to_json});"
        else
          "new Juggernaut(#{options.to_json});"
        end
      end
      
      def juggernaut_options(options = {})
        random_host = Juggernaut::Rails.random_host
        options = {
          :host                 => (random_host[:public_host] || random_host[:host]),
          :port                 => (random_host[:public_port] || random_host[:port]),
          :width                => '0px',
          :height               => '0px',
          :session_id           => request.session_options[:id],
          :swf_address          => "/juggernaut/juggernaut.swf",
          :ei_swf_address       => "/juggernaut/expressinstall.swf",
          :flash_version        => 8,
          :flash_color          => "#fff",
          :swf_name             => "juggernaut_flash",
          :bridge_name          => "juggernaut",
          :debug                => (RAILS_ENV == 'development'),
          :reconnect_attempts   => 3,
          :reconnect_intervals  => 3
        }.merge(options)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
juggernaut_rails-0.6.2 lib/juggernaut/rails/helpers.rb
juggernaut_rails-0.6.1 lib/juggernaut/rails/helpers.rb
juggernaut_rails-0.6.0 lib/juggernaut/rails/helpers.rb