Method: Marsdawn::Search::Rroonga#initialize

Defined in:
lib/marsdawn/search/rroonga.rb

#initialize(opts, storage) ⇒ Rroonga

Returns a new instance of Rroonga.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/marsdawn/search/rroonga.rb', line 5

def initialize opts, storage
  unless Module.const_defined?('Groonga')
    raise "Gem 'rroonga' should be installed." unless require 'groonga'
  end
  raise "The groonga database path should be specified" unless opts.key?(:path)
  @opts = {
    index_table: {}
  }.merge(opts)
  @storage = storage
  Groonga::Database.open(opts[:path])
  @table_prefix = "#{@storage.key}-#{@storage.lang}-#{@storage.version.tr('.','_')}"
end