lib/minglr/input_cache.rb in schubert-minglr-1.1.0 vs lib/minglr/input_cache.rb in schubert-minglr-1.2.0

- old
+ new

@@ -1,21 +1,21 @@ 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