Apps can hook in their own locator.

Adds #7.
Writing one now.

Den 20/08/2014 kl. 15.46 skrev Jeremy Kemper <notifications@github.com>:

> In lib/global_id/locator.rb:
> 
> > +      #
> > +      #   GlobalID::Locator.use :foo do |gid|
> > +      #     FooRemote.const_get(gid.model_name).find(gid.model_id)
> > +      #   end
> > +      #
> > +      # Using a class:
> > +      #
> > +      #   GlobalID::Locator.use :bar, BarLocator.new
> > +      #
> > +      #   class BarLocator
> > +      #     def locate(gid)
> > +      #       @search_client.search name: gid.model_name, id: gid.model_id
> > +      #     end
> > +      #   end
> > +      def use(app, locator = nil, &locator_block)
> > +        raise ArgumentError, 'No locator provided. Pass a block or an object that responds to #locate.' unless locator || block_given?
> We'll also need to validate that the app format is an allowed URI hostname, so no underscores (see #23).
> 
> —
> Reply to this email directly or view it on GitHub.
> 

--
Kasper