Method: Cow::Application#load_cache
- Defined in:
- lib/cow/application.rb
#load_cache(_cache = CACHE_FILE) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/cow/application.rb', line 65 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 |