--20cf301cc3c263a8a404a520bbc8 Content-Type: text/plain; charset=UTF-8 On Tue, Jun 7, 2011 at 3:54 PM, David Masover <ninja / slaphack.com> wrote: > > names.map{|name| name.split.last} > > I suppose I could do this instead, but it doesn't save any typing and > results > in an extra intermediate array being constructed: > > names.map(&:split).map(&:last) > > I'm sure I'm missing something, though. > Not too long ago I found http://drmcawesome.com/FunctionCompositionInRubywhich builds a consistent-ish way of doing this chaining. class Proc def |(other) lambda { |*args| self[other[*args]] } end end class Symbol def <(other) self.to_proc | other.to_proc end def >(other) other.to_proc | self.to_proc end end Model.find(:all).map &(:size>:others>:something) --20cf301cc3c263a8a404a520bbc8--