Class: Wee::JQuery

Inherits:
Object show all
Defined in:
lib/wee/jquery/jquery.rb

Constant Summary collapse

FILES =
%w(jquery-1.3.2.min.js wee-jquery.js)
PUBLIC_DIR =
File.expand_path(File.join(File.dirname(__FILE__), 'public'))

Class Method Summary collapse

Class Method Details

.install(mount_path, builder) ⇒ Object



6
7
8
9
10
# File 'lib/wee/jquery/jquery.rb', line 6

def self.install(mount_path, builder)
  builder.map(@mount_path = mount_path) do
    run Rack::File.new(PUBLIC_DIR)
  end
end

.javascript_includes(r) ⇒ Object



12
13
14
15
# File 'lib/wee/jquery/jquery.rb', line 12

def self.javascript_includes(r)
  raise "JQuery.install needs to be called" unless @mount_path
  FILES.each {|f| r.javascript.src("#{@mount_path}/#{f}") }
end