Sha256: 8ab59a9937be330cff3dd68863ee48b694bd445aa2e56ac61f03052e87cbf413

Contents?: true

Size: 652 Bytes

Versions: 4

Compression:

Stored size: 652 Bytes

Contents

# frozen_string_literal: true

module ElasticAPM
  class CentralConfig
    # @api private
    class CacheControl
      def initialize(value)
        @header = value
        parse!(value)
      end

      attr_reader(
        :must_revalidate,
        :no_cache,
        :no_store,
        :no_transform,
        :public,
        :private,
        :proxy_revalidate,
        :max_age,
        :s_maxage
      )

      private

      def parse!(value)
        value.split(',').each do |token|
          k, v = token.split('=').map(&:strip)
          instance_variable_set(:"@#{k.tr('-', '_')}", v ? v.to_i : true)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
elastic-apm-3.6.0 lib/elastic_apm/central_config/cache_control.rb
elastic-apm-3.5.0 lib/elastic_apm/central_config/cache_control.rb
elastic-apm-3.4.0 lib/elastic_apm/central_config/cache_control.rb
elastic-apm-3.3.0 lib/elastic_apm/central_config/cache_control.rb