class Firebolt::FileWarmer

Public Instance Methods

perform() click to toggle source
# File lib/firebolt/file_warmer.rb, line 7
def perform
  return nil unless cache_file_exists?

  parsed_contents
end

Private Instance Methods

cache_file() click to toggle source
# File lib/firebolt/file_warmer.rb, line 15
def cache_file
  ::Firebolt.config.cache_file
end
cache_file_exists?() click to toggle source
# File lib/firebolt/file_warmer.rb, line 19
def cache_file_exists?
  ::File.exists?(cache_file)
end
file_contents() click to toggle source
# File lib/firebolt/file_warmer.rb, line 23
def file_contents
  ::File.open(cache_file) do |file|
    file.read
  end
end
parsed_contents() click to toggle source
# File lib/firebolt/file_warmer.rb, line 29
def parsed_contents
  ::JSON.parse(file_contents)
rescue => e
  warn "Could not parse #{cache_file}, falling back to default warmer."
  return nil
end