class WeatherSage::CLI::Env::Cache
Create HTTP::Cache fron environment variables.
Constants
- DEFAULT_PATH
Default cache path.
Public Class Methods
new(env, log)
click to toggle source
Create HTTP::Cache fron environment variables.
Uses the following environment variables:
-
WEATHER_SAGE_CACHE_PATH: Path to HTTP cache file. Defaults to “~/.config/weather-sage/http-cache.pstore”.
Calls superclass method
WeatherSage::HTTP::Cache::new
# File lib/weather-sage/cli/env/cache.rb, line 20 def initialize(env, log) # get cache path unless path = env.get('CACHE_PATH') # use default cache path path = File.expand_path(DEFAULT_PATH) # create parent directories (if necessary) FileUtils.mkdir_p(File.dirname(path)) end # log cache path log.info('Env::Cache#initialize') do 'path = %p' % [path] end # return cache instance super(path, log) end