Class: Droonga::BufferedTCPSocket::ChunkLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/droonga/buffered_tcp_socket.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ ChunkLoader

Returns a new instance of ChunkLoader.



110
111
112
# File 'lib/droonga/buffered_tcp_socket.rb', line 110

def initialize(path)
  @path = path
end

Instance Method Details

#have_any_chunk?Boolean

Returns:

  • (Boolean)


114
115
116
117
118
119
120
121
# File 'lib/droonga/buffered_tcp_socket.rb', line 114

def have_any_chunk?
  @path.opendir do |dir|
    dir.each do |entry|
      return true if entry.end_with?(Chunk::SUFFIX)
    end
  end
  false
end

#loadObject



123
124
125
126
127
# File 'lib/droonga/buffered_tcp_socket.rb', line 123

def load
  Pathname.glob("#{@path}/*#{Chunk::SUFFIX}").collect do |chunk_path|
    Chunk.load(chunk_path)
  end
end