/* * call-seq: * RAMDirectory.new(dir = nil) * * Create a new RAMDirectory. * * You can optionally load another Directory (usually a FSDirectory) into * memory. This may be useful to speed up search performance but usually the * speedup won't be worth the trouble. Be sure to benchmark. * * dir:: Directory to load into memory */ static VALUE frb_ramdir_init(int argc, VALUE *argv, VALUE self) { VALUE rdir; Store *store; switch (rb_scan_args(argc, argv, "01", &rdir)) { case 1: { Store *ostore; Data_Get_Struct(rdir, Store, ostore); store = open_ram_store_and_copy(ostore, false); break; } default: store = open_ram_store(); } Frt_Wrap_Struct(self, NULL, &frb_dir_free, store); object_add(store, self); rb_ivar_set(self, id_ref_cnt, INT2FIX(0)); return self; }