module SelfishAssociations

A SelfishAssociation::Association is the main engine behind generating SelfishAssociations. They are primarily defined using the has_one_selfish, has_many_selfish methods. But if you want to debug and explor, you can initailize a SelfishAssociation::Association easily with a name and a model (class), options scope and other options.

assoc = SelfishAssociations::Association.new(:native_transcript, Video, ->(vid){where language_id: vid.language_id}, class_name: "Transcript")

Use the :joins, :find, :create, and :matches methods to play!

A scope reader is an object that response to scope methods such as `where` and `create_with`. It must return a ScopeReader for each of these methods so that these methods can be chained. For it to be useful, these methods must also have side effects that can be inspected by a third party.

For SelfishAssociations, we generally want to support passing a single argument to the scope lambda. E.g. `->(record){ where field: record.matching_field }`. In order to collect useful information, we may want to pass a special object in place of `record`: one that can respond to the same methods that `record` could respond to, but in doing so collects information about each call that is being made. This is what we are using the `AssociationTraverser` for in `ScopeReaders::Relation`. This traverser can respond to relations and field names of the record model. Similarly, it returns a modified traverser in respons to this so that those calls may also be chained. For more, see association_traverser.rb.

We use bang method names to avoid conflicting with valid association and column names