[Rubygems-developers] Overhaul of specification.rb

Gavin Sinclair gsinclair at soyabean.com.au
Sun Aug 15 11:41:55 EDT 2004


On Monday, August 16, 2004, 12:44:13 AM, why wrote:

> Gavin Sinclair wrote:
>> 
>> I had a thought earlier about this problem though, the general problem
>> of Gem::Specification objects being created in two different ways
>> (Ruby and YAML).  A general solution would be this:
>> 

> Hey, Gavin?  I really think you should move away from serialization of
> the Gem::Specification as a !ruby/object.  I've had lots of requests for
> the `from_yaml' and `initialize_yaml' stuff, which I'm kinda resistant
> to.  All the scenarios I've seen which demand these methods could be
> solved by using a domain type.

> Use to_yaml_type and YAML::add_domain_type to set this up.  [....]

Thanks for the tip, _why.  I'll definitely take a look at it (and
might ask more questions about it).  However, I wasn't suggesting a
from_yaml in YAML itself, just a special constructor for the
Specification class.  It would then be the resonsibility of client
code to use Specification.from_yaml(File.read(...)) rather than
YAML.load(File.read(...)).

I've a hunch that wouldn't really solve the inter-spec migration
problem anyway.  But your domain types just might, if each version of
the spec is a different type.  I'll have some time tomorrow night to
look into it.

Thanks again,
Gavin



More information about the Rubygems-developers mailing list