Sha256: 4b95e705b2a8cfea4ffb91b931b47ecedf4a73b5a59a41d57a8c90f61b5a328e

Contents?: true

Size: 640 Bytes

Versions: 8

Compression:

Stored size: 640 Bytes

Contents

module Index
  
  module File
    
    class Text < Basic
      
      def extension
        :txt
      end
      def load
        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|
            id, token = line.split ?,, 2
            yield id.to_i, (token.chomp! || token).to_sym
          end
        end
      end
      
    end
    
  end
  
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
picky-0.11.2 lib/picky/index/file/text.rb
picky-0.11.1 lib/picky/index/file/text.rb
picky-0.11.0 lib/picky/index/file/text.rb
picky-0.10.5 lib/picky/index/file/text.rb
picky-0.10.4 lib/picky/index/file/text.rb
picky-0.10.2 lib/picky/index/file/text.rb
picky-0.10.1 lib/picky/index/file/text.rb
picky-0.10.0 lib/picky/index/file/text.rb