Sha256: 4d6c98adede76a8dd7e3d47904864b302b84ff1d1d7af54543e217a40923e6d4

Contents?: true

Size: 599 Bytes

Versions: 1

Compression:

Stored size: 599 Bytes

Contents

module Sinatra

  class Application

    helpers do
      def multi_screen_js
        "#{env['rack.url_scheme']}://#{env['HTTP_HOST']}#{env['SCRIPT_NAME']}/cometio/multiscreen.js"
      end
    end

    get '/cometio/multiscreen.js' do
      content_type 'application/javascript'
      @js ||= (
               js = ''
               Dir.glob(File.expand_path '../js/*.js', File.dirname(__FILE__)).each do |i|
                 File.open(i) do |f|
                   js += f.read
                 end
               end
               ERB.new(js).result(binding)
               )
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sinatra-multi-screen-0.0.1 lib/sinatra/application.rb