module Charty::CacheDir

Public Instance Methods

cache_dir_path() click to toggle source
# File lib/charty/cache_dir.rb, line 7
def cache_dir_path
  platform_cache_dir_path + "charty"
end
path(*path_components) click to toggle source
# File lib/charty/cache_dir.rb, line 23
def path(*path_components)
  cache_dir_path.join(*path_components)
end
platform_cache_dir_path() click to toggle source
# File lib/charty/cache_dir.rb, line 11
def platform_cache_dir_path
  base_dir = case RUBY_PLATFORM
             when /mswin/, /mingw/
               ENV.fetch("LOCALAPPDATA", "~/AppData/Local")
             when /darwin/
               "~/Library/Caches"
             else
               ENV.fetch("XDG_CACHE_HOME", "~/.cache")
             end
  Pathname(base_dir).expand_path
end