/doc/1.6.0/enumerable/inGroupsOf.html
HTML | 319 lines | 125 code | 187 blank | 7 comment | 0 complexity | 75c336325d0975d53993ed031fa50820 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Prototype v1.6.0 API documentation | Enumerable.inGroupsOf</title>
- <link href="../stylesheets/main.css" rel="stylesheet" type="text/css" />
- <link rel="stylesheet" type="text/css" media="print" href="../stylesheets/api-print.css" />
- <!--[if lte IE 6]><link href="/stylesheets/ie-sucks-for-api.css" rel="stylesheet" type="text/css" media="screen"><![endif]-->
- <link href="http://feeds.feedburner.com/prototype-blog" rel="alternate" type="application/atom+xml" />
- <script src="../javascripts/prototype.js" type="text/javascript"></script>
- <script src="../javascripts/code_highlighter.js" type="text/javascript"></script>
- <script src="../javascripts/javascript.js" type="text/javascript"></script>
- <script src="../javascripts/html.js" type="text/javascript"></script>
- <script src="../javascripts/css.js" type="text/javascript"></script>
- <script src="../javascripts/ruby.js" type="text/javascript"></script>
- <script src="../javascripts/ebnf.js" type="text/javascript"></script>
- <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
- </script>
- <script type="text/javascript">
- _uacct = "UA-82668-3";
- urchinTracker();
- </script>
- <link rel="shortcut icon" href="../images/fav.png" type="image/ico" />
- </head>
- <body>
- <!-- container -->
- <div id="container">
-
-
- <!-- content -->
- <div id="content">
- <div id="cnt-inner">
- <div id="sidebar">
-
-
-
-
- <div class="sblock">
- <h3 class="object"><a class="selected" href="../enumerable.html">Enumerable</a></h3>
- <ul class="methods">
-
-
-
-
- <li><a href="all.html">all</a></li>
-
-
-
- <li><a href="any.html">any</a></li>
-
-
-
- <li><a href="collect.html">collect</a></li>
-
-
-
- <li><a href="detect.html">detect</a></li>
-
-
-
- <li><a href="each.html">each</a></li>
-
-
-
- <li><a href="eachSlice.html">eachSlice</a></li>
-
-
-
- <li><a href="entries.html">entries</a></li>
-
-
-
- <li><a href="find.html">find</a></li>
-
-
-
- <li><a href="findAll.html">findAll</a></li>
-
-
-
- <li><a href="grep.html">grep</a></li>
-
-
-
- <li class="selected"><a class="selected" href="inGroupsOf.html">inGroupsOf</a></li>
-
-
-
- <li><a href="include.html">include</a></li>
-
-
-
- <li><a href="inject.html">inject</a></li>
-
-
-
- <li><a href="invoke.html">invoke</a></li>
-
-
-
- <li><a href="map.html">map</a></li>
-
-
-
- <li><a href="max.html">max</a></li>
-
-
-
- <li><a href="member.html">member</a></li>
-
-
-
- <li><a href="min.html">min</a></li>
-
-
-
- <li><a href="partition.html">partition</a></li>
-
-
-
- <li><a href="pluck.html">pluck</a></li>
-
-
-
- <li><a href="reject.html">reject</a></li>
-
-
-
- <li><a href="select.html">select</a></li>
-
-
-
- <li><a href="size.html">size</a></li>
-
-
-
- <li><a href="sortBy.html">sortBy</a></li>
-
-
-
- <li><a href="toArray.html">toArray</a></li>
-
-
-
- <li><a href="zip.html">zip</a></li>
-
-
- </ul>
- </div>
-
-
-
- <div class="sblock">
- <h3>API Docs</h3>
-
- <ul class="objects">
- <li><a href="../utility.html" title="Utility Methods">Utility Methods</a></li>
-
-
- <li><a href="../ajax.html" title="Ajax">Ajax</a></li>
-
-
-
- <li><a href="../array.html" title="Array">Array</a></li>
-
-
-
- <li><a href="../class.html" title="Class">Class</a></li>
-
-
-
- <li><a href="../date.html" title="Date">Date</a></li>
-
-
-
- <li><a href="../element.html" title="Element">Element</a></li>
-
-
-
- <li><a href="../element/methods.html" title="Element.Methods">Element.Methods</a></li>
-
-
-
- <li><a href="../element/methods/simulated.html" title="Element.Methods.Simulated">Element.Methods.Simulated</a></li>
-
-
-
- <li><a href="../enumerable.html" title="Enumerable">Enumerable</a></li>
-
-
-
- <li><a href="../event.html" title="Event">Event</a></li>
-
-
-
- <li><a href="../form.html" title="Form">Form</a></li>
-
-
-
- <li><a href="../form/element.html" title="Form.Element">Form.Element</a></li>
-
-
-
- <li><a href="../function.html" title="Function">Function</a></li>
-
-
-
- <li><a href="../hash.html" title="Hash">Hash</a></li>
-
-
-
- <li><a href="../insertion.html" title="Insertion">Insertion</a></li>
-
-
-
- <li><a href="../number.html" title="Number">Number</a></li>
-
-
-
- <li><a href="../object.html" title="Object">Object</a></li>
-
-
-
- <li><a href="../objectRange.html" title="ObjectRange">ObjectRange</a></li>
-
-
-
- <li><a href="../periodicalExecuter.html" title="PeriodicalExecuter">PeriodicalExecuter</a></li>
-
-
-
- <li><a href="../position.html" title="Position">Position</a></li>
-
-
-
- <li><a href="../prototype.html" title="Prototype">Prototype</a></li>
-
-
-
- <li><a href="../string.html" title="String">String</a></li>
-
-
-
- <li><a href="../template.html" title="Template">Template</a></li>
-
-
-
- <li><a href="../timedObserver.html" title="TimedObserver">TimedObserver</a></li>
-
-
-
-
-
- <li><a href="../document.html" title="document">document</a></li>
-
-
-
- <li><a href="../document/viewport.html" title="document.viewport">document.viewport</a></li>
-
-
- </ul>
- </div>
- </div>
- <!-- main -->
- <div id="main" class="clearfix">
-
- <div id="main-content">
-
- <h2>inGroupsOf
- </h2>
-
- <div id="excerpt"><pre><code class="ebnf">inGroupsOf(size[, filler = null]) -> [group...]</code></pre>
- <p>Groups items in fixed-size chunks, using a specific value to fill up the last chunk if necessary.</p></div>
- <div id="abody"><h3>Example</h3>
- <pre><code class="javascript">
- var students = [
- { name: 'Sunny', age: 20 }, { name: 'Audrey', age: 21 },
- { name: 'Matt', age: 20 }, { name: 'Élodie', age: 26 },
- { name: 'Will', age: 21 }, { name: 'David', age: 23 },
- { name: 'Julien', age: 22 }, { name: 'Thomas', age: 21 },
- { name: 'Serpil', age: 22 }
- ];
- students.pluck('name').inGroupsOf(4) {
- // -> [ ['Sunny', 'Audrey', 'Matt', 'Élodie'],
- // ['Will', 'David', 'Julien', 'Thomas'],
- // ['Serpil', null, null, null] ]
- </code></pre>
- <h3>See also</h3>
- <p>There is a variant called <a href="eachSlice.html"><code>eachSlice</code></a>, which does not fill up the last group to size.</p></div>
-
- </div>
- </div>
- <!-- /main -->
- </div>
- </div>
- <!-- /content -->
- <div id="footer">
- © 2006-2007 Prototype Core Team | Licenses:
- <a rel="license" href="http://dev.rubyonrails.org/browser/spinoffs/prototype/trunk/LICENSE?format=raw">MIT (source code)</a> and <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><abbr title="Creative Commons Attribution-Share Alike 3.0 License">CC BY-SA</abbr> (documentation)</a>.
- <a id="badge" href="http://mephistoblog.com" title="This site's mojo provided by Mephisto"><img alt="mephisto-badge-tiny" src="../images/mephisto-badge-tiny.png" /></a>
- </div>
- </div>
- <!-- /container -->
- </body>
- </html>