Class: Nanoc3::Extra::CHiCk::CacheController

CHiCk::CacheController sets the Cache-Control header (and more specifically, max-age) to limit the number of necessary requests.

Constructor Summary

public initialize(app, options = {})
[View source]


61
62
63
64
# File 'lib/nanoc3/extra/chick.rb', line 61

def initialize(app, options={})
  @app = app
  @options = options
end

Public Visibility

Public Instance Method Summary

#call(env)

Public Instance Method Details

call

public call(env)
[View source]


66
67
68
69
70
71
72
# File 'lib/nanoc3/extra/chick.rb', line 66

def call(env)
  res = @app.call(env)
  unless res[1].has_key?('Cache-Control') || res[1].has_key?('Expires')
    res[1]['Cache-Control'] = "max-age=#{@options[:max_age]}"
  end
  res
end
Generated on Sunday, August 09 2009 at 01:43:13 PM by YARD 0.2.3.2 (ruby-1.8.7).