Module: Rack::JQuery::Helpers

Defined in:
lib/rack/jquery/helpers.rb,
lib/rack/jquery/helpers/version.rb

Overview

Bits of code that were being duplicated in each rack-jquery* library.

Constant Summary collapse

TEN_YEARS =

Ten years in seconds.

60 * 60 * 24 * 365 * 10
VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#caching_headers(etag, last_modified) ⇒ Hash

Build the headers for caching.

Parameters:

  • etag (String)
  • last_modified (String)

Returns:

  • (Hash)


17
18
19
20
21
22
23
24
25
# File 'lib/rack/jquery/helpers.rb', line 17

def caching_headers( etag, last_modified )
  {
    "Last-Modified" => last_modified,
    "Expires"    => Rack::Utils.rfc2109(Time.now + TEN_YEARS),
    "Cache-Control" => "max-age=#{TEN_YEARS},public",
    "Etag"          => etag,
    'Content-Type' =>'application/javascript; charset=utf-8'
  }
end