Just extend it yourself until they get it in there... ;)

def DataMapper.repositories
   DataMapper::Repository.repository_keys
end

God, I love Ruby!

:: Justin Reagor
:: [email protected]




On Jun 11, 2009, at 5:13 PM, Ted Han wrote:

> Hey dkubb & gang,
>
> I have found some need for some convenience methods on  
> Repositories.  It seems weird to me that  
> DataMapper.repository(name=nil) exists, but there's no way to easily  
> get the candidate repository names.  The only way to get to that  
> info is to say "DataMapper::Repository.adapters.keys".  I'd propose  
> DataMapper.repositories as a proxy for the keys, but that's weird  
> because DataMapper.repository returns a DataMapper::Repository, so  
> presumably DataMapper.repositories should return a list of objects  
> of the same class.  Additionally to facilitate that, there should be  
> a DataMapper::Repository.repository_keys (or i guess even just  
> DataMapper::Repository.keys).
>
> So here's what i'd propose:
>
> require 'dm-core'
>
> DataMapper.setup(:tacos, :adapter=>:in_memory)
> DataMapper.setup(:monkeys, :adapter=>:in_memory)
> DataMapper.setup(:tribbles, :adapter=>:in_memory)
>
> DataMapper::Repository.repository_keys # =>  
> [:tacos, :monkeys, :tribbles]
> DataMapper.repositories # => [#<DataMapper::Repository @name=tacos>,  
> #<DataMapper::Repository @name=monkeys>, #<DataMapper::Repository  
> @name=tribbles>]
>
> Thoughts?  Suggestions?
>
> -Ted (knowtheory)
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to