Module: ActionDispatch::Http::Cache::Response

Included in:
Response
Defined in:
actionpack/lib/action_dispatch/http/cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cache_controlObject (readonly)

Returns the value of attribute cache_control



54
55
56
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 54

def cache_control
  @cache_control
end

#etagObject Also known as: etag?

Returns the value of attribute etag



54
55
56
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 54

def etag
  @etag
end

Instance Method Details

#dateObject



71
72
73
74
75
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 71

def date
  if date_header = headers['Date']
    Time.httpdate(date_header)
  end
end

#date=(utc_time) ⇒ Object



81
82
83
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 81

def date=(utc_time)
  headers['Date'] = utc_time.httpdate
end

#date?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 77

def date?
  headers.include?('Date')
end

#last_modifiedObject



57
58
59
60
61
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 57

def last_modified
  if last = headers[LAST_MODIFIED]
    Time.httpdate(last)
  end
end

#last_modified=(utc_time) ⇒ Object



67
68
69
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 67

def last_modified=(utc_time)
  headers[LAST_MODIFIED] = utc_time.httpdate
end

#last_modified?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'actionpack/lib/action_dispatch/http/cache.rb', line 63

def last_modified?
  headers.include?(LAST_MODIFIED)
end