lib/picky/index/file/text.rb in picky-0.9.4 vs lib/picky/index/file/text.rb in picky-0.10.0
- old
+ new
@@ -11,13 +11,18 @@
raise "Can't load from text file. Use JSON or Marshal."
end
def dump hash
raise "Can't dump to text file. Use JSON or Marshal."
end
+
+ # Yields an id and a symbol token.
+ #
def retrieve
+ id, token =
::File.open(cache_path, 'r:binary') do |file|
file.each_line do |line|
- yield line.split ?,, 2
+ id, token = line.split ?,, 2
+ yield id.to_i, (token.chomp! || token).to_sym
end
end
end
end
\ No newline at end of file