class GdsApi::Response::CacheControl
def initialize(value = nil)
def initialize(value = nil) super() parse(value) end
def max_age
def max_age self["max-age"].to_i if key?("max-age") end
def must_revalidate?
def must_revalidate? self["must-revalidate"] end
def no_cache?
def no_cache? self["no-cache"] end
def no_store?
def no_store? self["no-store"] end
def parse(header)
def parse(header) return if header.nil? || header.empty? header.scan(PATTERN).each do |name, value| self[name.downcase] = value || true end end
def private?
def private? self["private"] end
def proxy_revalidate?
def proxy_revalidate? self["proxy-revalidate"] end
def public?
def public? self["public"] end
def reverse_max_age
def reverse_max_age self["r-maxage"].to_i if key?("r-maxage") end
def shared_max_age
def shared_max_age self["s-maxage"].to_i if key?("r-maxage") end
def to_s
def to_s directives = [] values = [] each do |key, value| if value == true directives << key elsif value values << "#{key}=#{value}" end end (directives.sort + values.sort).join(", ") end