Method: Cow::Application#load_cache
- Defined in:
- lib/cow/application.rb
#load_cache(_cache = CACHE_FILE) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/cow/application.rb', line 48 def load_cache(_cache = CACHE_FILE) unless File.exist?(_cache) puts 'Cache file is not found. Creating...' create_cache(_cache) end if File.size(_cache) < 5 puts 'Cache file looks empty. Creating...' create_cache(_cache) end cache = YAML.load(File.read(_cache)) if cache.class == Cow::Application::Cache @cache = cache else raise 'Cache file is corrupt?' end end |