Module: Sinatra::Sammy::Helpers

Defined in:
lib/sinatra/sammy.rb

Instance Method Summary collapse

Instance Method Details

#jquery_jsObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sinatra/sammy.rb', line 14

def jquery_js
  if production?
    %{<script 
        type="text/javascript" 
        src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
      </script>}
  else
    %{<script type="text/javascript" charset="utf-8">
      #{File.read(vendor_path('jquery-1.3.2.min.js'))}
    </script>}
  end
end

#sammy(sammy_options = {}) ⇒ Object



9
10
11
12
# File 'lib/sinatra/sammy.rb', line 9

def sammy(sammy_options = {})
  @sammy_options = sammy_options
  ERB.new(File.read(File.join(File.dirname(__FILE__), 'sammy.erb'))).result(binding)
end

#sammy_jsObject



27
28
29
# File 'lib/sinatra/sammy.rb', line 27

def sammy_js
  File.read(vendor_path('sammy.min.js'))
end