Sha256: 3a3989f315094eacdb8644dd21b941a434e8029072219057566dad117245f0bc
Contents?: true
Size: 475 Bytes
Versions: 1
Compression:
Stored size: 475 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
schubert-minglr-1.2.0 | lib/minglr/input_cache.rb |