Clifford Heath
2/7/2008 10:44:00 PM
Phlip wrote:
> Jeremy Kemper wrote:
>
> > > Sure. &:position == :position.to_proc == proc { |element, *args|
> > > element.position(*args) }
> > >
> > > So elements.sort_by(&:position) is shorthand for sorting the
> elements by
> > > position.
>
> How would you pass the *args in?? They don't seem to fit on either side
> of the &, which is "special" in argument passing syntax...
You can't. If you need to, you should hand-roll something like Jeremy's
third case.
Clifford Heath.