lib/daijobu/adapter.rb in sander6-daijobu-0.2.0 vs lib/daijobu/adapter.rb in sander6-daijobu-0.2.1
- old
+ new
@@ -1,7 +1,17 @@
module Daijobu
+
+ # Daijobu::Adapter is the parent module of the various adapter classes.
module Adapter
+ # Given an object, returns a new instance of the corresponding adapter based on the
+ # object's class.
+ #
+ # MemCache => Daijobu::Adapter::MemCacheAdapter
+ # Rufus::Tokyo::Cabinet => Daijobu::Adapter::TokyoCabinetAdapter
+ # Rufus::Tokyo::Tyrant => Daijobu::Adapter::TokyoTyrantAdapter
+ #
+ # Raises Daijobu::InvalidAdapter if given a object it doesn't know about.
def self.get(casket)
if defined?(MemCache) && casket.is_a?(MemCache)
Daijobu::Adapter::MemCacheAdapter.new(casket)
elsif defined?(Rufus::Tokyo::Cabinet) && casket.is_a?(Rufus::Tokyo::Cabinet)
Daijobu::Adapter::TokyoCabinetAdapter.new(casket)
\ No newline at end of file