From 1a8665105598e80392620b736bc0d701f550706f Mon Sep 17 00:00:00 2001 From: tjcrowder Date: Mon, 7 Sep 2009 15:52:22 +0100 Subject: [PATCH] doc: merged old docs for Enumerable#invoke. --- src/lang/enumerable.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/lang/enumerable.js b/src/lang/enumerable.js index d819f09..3b1fbb0 100644 --- a/src/lang/enumerable.js +++ b/src/lang/enumerable.js @@ -456,9 +456,23 @@ var Enumerable = (function() { /** * Enumerable#invoke(methodName[, arg...]) -> Array + * - methodName (String): The name of the method to invoke. + * - args (?): Optional arguments to pass to the method. * - * Invokes the same method, with the same arguments, for all items in a collection. - * Returns the results of the method calls. + * Invokes the same method, with the same arguments, for all items in a + * collection. Returns an array of the results of the method calls. + * + * ### Examples + * + * ['hello', 'world'].invoke('toUpperCase'); + * // -> ['HELLO', 'WORLD'] + * + * ['hello', 'world'].invoke('substring', 0, 3); + * // -> ['hel', 'wor'] + * + * $$('input').invoke('stopObserving', 'change'); + * // -> Stops observing the 'change' event on all input elements, + * // returns an array of the element references. **/ function invoke(method) { var args = $A(arguments).slice(1);