module ShafClient::HypertextCacheStrategy

Constants

AVAILABLE_CACHE_STRATEGIES

Public Class Methods

cacheable?(strategy) click to toggle source
# File lib/shaf_client/hypertext_cache_strategy.rb, line 10
def cacheable?(strategy)
  [CACHE_STRATEGY_EMBEDDED, CACHE_STRATEGY_FETCH_HEADERS].include? strategy
end
default_http_status() click to toggle source
# File lib/shaf_client/hypertext_cache_strategy.rb, line 18
def default_http_status
  203
end
fetch_headers?(strategy) click to toggle source
# File lib/shaf_client/hypertext_cache_strategy.rb, line 14
def fetch_headers?(strategy)
  CACHE_STRATEGY_FETCH_HEADERS == strategy
end

Public Instance Methods

default_hypertext_cache_strategy() click to toggle source
# File lib/shaf_client/hypertext_cache_strategy.rb, line 23
def default_hypertext_cache_strategy
  @__default_hypertext_cache_strategy ||= CACHE_STRATEGY_EMBEDDED
end
default_hypertext_cache_strategy=(strategy) click to toggle source
# File lib/shaf_client/hypertext_cache_strategy.rb, line 27
    def default_hypertext_cache_strategy=(strategy)
      unless __valid_cache? strategy
        raise Error, <<~ERR
          Unsupported hypertext cache strategy: #{strategy}
          Possible strategies are: #{AVAILABLE_CACHE_STRATEGIES.join(', ')}
        ERR
      end
      @__default_hypertext_cache_strategy = value
    end

Private Instance Methods

__valid_cache?(strategy) click to toggle source
# File lib/shaf_client/hypertext_cache_strategy.rb, line 39
def __valid_cache?(strategy)
  AVAILABLE_CACHE_STRATEGIES.include? strategy
end