instance method parse_directives

Ruby on Rails 8.1.2

Since v8.1.2 Private

Signature

parse_directives(header_value)

No documentation comment.

Parameters

header_value req
Source
# File actionpack/lib/action_dispatch/http/cache.rb, line 147
            def parse_directives(header_value)
              return unless header_value

              header_value.delete(" ").downcase.split(",").each do |directive|
                name, value = directive.split("=", 2)

                case name
                when "max-age"
                  @max_age = value.to_i
                when "min-fresh"
                  @min_fresh = value.to_i
                when "stale-if-error"
                  @stale_if_error = value.to_i
                when "no-cache"
                  @no_cache = true
                when "no-store"
                  @no_store = true
                when "no-transform"
                  @no_transform = true
                when "only-if-cached"
                  @only_if_cached = true
                when "max-stale"
                  @max_stale = value ? value.to_i : true
                end
              end
            end

Defined in actionpack/lib/action_dispatch/http/cache.rb line 147 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionDispatch::Http::Cache::Request::CacheControlDirectives

Type at least 2 characters to search.

↑↓ navigate · open · esc close