Encode signed global id metadata with a hash.

Based on @jeremy's message here: https://github.com/rails/globalid/pull/29#discussion_r16596489

Let's us accommodate new metadata without breaking old messages.

This change also flips some `assert_equal` calls with wrong ordered arguments.
What do we do about that mismatch? Introduce a uniform serializer, which calls `with_indifferent_access`?

Den 22/08/2014 kl. 16.28 skrev Jeremy Kemper <notifications@github.com>:

> In lib/global_id/signed_global_id.rb:
> 
> > @@ -29,8 +29,8 @@ def pick_purpose(options)
> >  
> >      private
> >        def verify(sgid, options)
> > -        gid, parsed_purpose = pick_verifier(options).verify(sgid)
> > -        gid if pick_purpose(options) == parsed_purpose
> > +        metadata = pick_verifier(options).verify(sgid)
> > +        metadata['gid'] if pick_purpose(options) == metadata['purpose']
> If the verifier uses a different serializer, like YAML or Marshal, these will be Symbol keys. They happen to be Strings since we're using a JSON serializer in tests.
> 
> —
> Reply to this email directly or view it on GitHub.
> 

--
Kasper