Skip to content

Instantly share code, notes, and snippets.

@pragdave
Last active December 17, 2015 19:09
Show Gist options
  • Save pragdave/5658394 to your computer and use it in GitHub Desktop.
Save pragdave/5658394 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- xml -*- -->
<!DOCTYPE ref-class SYSTEM "local/xml/markup.dtd">
<ref-class name="Array" id="ref:Array" super-class="Object">
<mi:Class>Array</mi:Class>
<relies-on>each, &lt;=&gt;</relies-on>
<p>
Arrays are ordered, integer-indexed collections of any object.
Array indexes start at 0, as in C or Java. A negative index is
relative to the end of the array; that is, an index of -1
indicates the last element of the array, -2 is the next-to-last
element in the array, and so on.
</p>
<mixins>
<mixin name="Enumerable">
<runcode op="raw">
puts Enumerable.instance_methods.sort.join(", ")
</runcode>
</mixin>
</mixins>
<class-methods type="class">
<meth>
<method-name>[ ]</method-name>
<usages>
<usage>Array[ <optz>obj</optz> ] <returns><obj>an_array</obj></returns></usage>
</usages>
<description>
<p>
Returns a new array populated with the given objects. Equivalent to
the operator form <ic>Array.[...]</ic>.
</p>
<runcode op="comment">
Array.[]( 1, 'a', /^A/ )
Array[ 1, 'a', /^A/ ]
[ 1, 'a', /^A/ ]
</runcode>
</description>
</meth>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment