Brian Schröäer schrieb: > I'd understand this > >> %w{a long list of words}.collect.length > > as giving me the length of the return value of collect. Collect > returns an array so I'd expect the above to return five. Maybe it > would be better to write > > %w{a long list of words}.collect_with :length > > where in method missing something like this would happen > > module Enumerable > def method_missing(method, *methods, &block) > if /(^.*)_with$/ =~ method.to_s > send($1) do | a | > methods.inject(a) { | r, m | r.send(m) } > end > else > super > end > end > end > > %w{a long list of words}.collect_with :length, :to_s > # => ["1", "4", "4", "2", "5"] With the famous class Symbol def to_proc lambda { |obj| obj.send self } end end you can get the same result via %w{a long list of words}.map(&:length).map(&:to_s) I'd bet the Symbol#to_proc is somewhere in Nano. Regards, Pit