On Aug 5, 2011, at 12:02 PM, joe wrote:
> I think I should be able to figure this out, but since I'm pretty new
> to both ruby and DM I haven't been able to.

Learning a big library like DM at the same time as the language it's written in 
is no easy task. Kudos for taking it on.

> I want an enum property
>   property :filter,       Enum[Tilt.mappings.keys]
> 
> (where Tilt.mappings is obviously a hash). However, instead of an
> array of flags from the keys, this results in a single flag that is an
> array of the keys, but I can't figure out a syntax to make this work
> the way I want.

You want a splat (`*`) to decompose the Array returned from Hash#keys into a 
list to pass to Enum.[]:

  property :filter, Enum[*Tilt.mappings.keys]

> Any help appreciated!

Hope that helps,

—Emmanuel

-- 
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