Module: Jabs::Rack

Defined in:
lib/jabs/middleware.rb

Defined Under Namespace

Classes: File, Static

Class Method Summary collapse

Class Method Details

.mount(rack_builder, mount_pount) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/jabs/middleware.rb', line 4

def self.mount(rack_builder, mount_pount)
  rack_builder.map(mount_pount) do
    run (lambda do |env|
      source = %w{
        jquery/jquery-1.3.2.js
        jquery/jquery.event.drag-1.5.js
        jquery/jquery.event.drop-1.2.js
        jquery/jquery.focus_and_blur.js
      }.map{|path| (Jabs.root+path).read }.join("\n")
      
      [200, {'Content-Type'=> 'text/javascript'}, source]
    end)
  end
end