class Gub::Cache

Public Class Methods

new(base_dir) click to toggle source
# File lib/gub/cache.rb, line 3
def initialize base_dir
  @base_dir = base_dir
end

Public Instance Methods

get(key) click to toggle source
# File lib/gub/cache.rb, line 14
def get key
  cached_path = @base_dir + '/' + key
  if File.exists? cached_path
    return IO.read cached_path
  end
end
set(key, value) click to toggle source
# File lib/gub/cache.rb, line 7
def set key, value
  cached_path = @base_dir + '/' + key
  File.open(cached_path, 'w') do |f|
    f.puts value
  end
end