mongodb/mongo-ruby-driver — pull request #404 by estolfo (2014-04-21 17:46:20+00:00)
Title: RUBY-624 Read preference modeling

This pull request includes classes for each read preference, a Selectable module that each read preference includes, and a read preference "factory".

To get a particular read preference object, you can use the ReadPreference module method #get:

read_pref = Mongo::ReadPreference.get(:secondary, [{'tag' => 'set'}], 20)

You can then pass a list of candidates to the read preference object's #select_nodes method:

read_pref.select_nodes(candidates)

The method will return a list of nodes matching the read preference, in preference order, on which an operation can be executed.

I'll be adding in documentation next.