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.



89
90
91
# File 'lib/droonga/buffered_tcp_socket.rb', line 89

def initialize(path)
  @path = path
end

Instance Method Details

#have_any_chunk?Boolean

Returns:

  • (Boolean)


93
94
95
96
97
98
99
100
# File 'lib/droonga/buffered_tcp_socket.rb', line 93

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



102
103
104
105
106
# File 'lib/droonga/buffered_tcp_socket.rb', line 102

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