You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jnunemaker edited this page Nov 16, 2012
·
4 revisions
Creating your own adapter is as easy as defining a few methods -- read, write, delete and clear. Here is an example that defines an adapter where the client is a ruby hash. Adapters can also work with options, you can read more at Allowing for Options.
Adapter.define works with a name and block, name and module, or name, module and block. When module and block are provided, the module is included into the adapter first and the block second. This allows you to take an existing adapter defined in a module and tweak a few things in the block (such as encode and decode).
There are some rspec shared examples available if you are creating and testing your own adapter.