Module: GHTorrent::Persister

Constant Summary collapse

ADAPTERS =
{
  :mongo => GHTorrent::MongoPersister,
  :noop => GHTorrent::NoopPersister
}

Instance Method Summary collapse

Instance Method Details

#connect(adapter, settings) ⇒ Object

Factory method for retrieving persistence connections. The settings argument is a fully parsed YAML document passed on to adapters. The available adapter are ‘mongo’ and ‘noop’



17
18
19
20
# File 'lib/ghtorrent/persister.rb', line 17

def connect(adapter, settings)
  driver = ADAPTERS[adapter.intern]
  driver.new(settings)
end

#disconnectObject



22
23
24
# File 'lib/ghtorrent/persister.rb', line 22

def disconnect
  driver.close
end