Sha256: ae41e6a8b06b31df94c398b0176d049e755b2c9b6421cbf5eef573deb91704b3
Contents?: true
Size: 469 Bytes
Versions: 4
Compression:
Stored size: 469 Bytes
Contents
class InputCache class << self def put(key, content) File.open(file_pathname(key), File::CREAT | File::WRONLY | File::TRUNC) { |file| file.write content } end def get(key) if content = File.read(file_pathname(key)) return nil if content.blank? content end rescue nil end protected def file_pathname(key) File.join(Dir::tmpdir, "#{key.to_s.gsub(/[^\w]/, '')}.entry") end end end
Version data entries
4 entries across 4 versions & 2 rubygems