1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
<ppdoc>
<copyright>
Copyright (c) 2001 by Addison Wesley Longman. This
material may be distributed only subject to the terms and
conditions set forth in the Open Publication License, v1.0 or
later (the latest version is presently available at
http://www.opencontent.org/openpub/).
</copyright>
<class name="NilClass" super="Object" type="class">
The class of the singleton object <tt>nil</tt>.
<p/>
<methods type="instance">
<method name="&" ref="_et">
<callseq>
<tt>nil</tt>& <obj>anObject</obj>
<returns><const>false</const></returns>
</callseq>
<desc>
<p/>
And---Returns <const>false</const>. As <obj>anObject</obj> is an
argument to a method call, it is always evaluated; there is no
short-circuit evaluation in this case.
<p/>
<codefragment>
<alltt><fullcode><![CDATA[ nil && puts("logical and")
nil & puts("and")
]]></fullcode>
nil<nbsp/>&&<nbsp/>puts("logical<nbsp/>and")
nil<nbsp/>&<nbsp/><nbsp/>puts("and")
</alltt>
</codefragment>
<em>produces:</em>
<codefragment><alltt>
and
</alltt>
</codefragment>
<p/>
</desc>
</method>
<p/>
<method name="^" ref="_up">
<callseq>
<tt>nil</tt>^ <obj>anObject</obj>
<returns><const>true</const> or <const>false</const></returns>
</callseq>
<desc>
<p/>
Exclusive Or---Returns <const>false</const> if <obj>anObject</obj> is <const>nil</const> or
<const>false</const>,
<const>true</const> otherwise.
<p/>
</desc>
</method>
<p/>
<method name="|" ref="_ba">
<callseq>
<tt>nil</tt>| <obj>anObject</obj>
<returns><const>true</const> or <const>false</const></returns>
</callseq>
<desc>
<p/>
Or---Returns <const>false</const> if <obj>anObject</obj> is
<const>nil</const> or <const>false</const>, <const>true</const> otherwise.
<p/>
</desc>
</method>
<p/>
<method name="nil?" ref="nil_qm">
<callseq>
<tt>nil</tt>.nil? <returns><const>true</const></returns>
</callseq>
<desc>
<p/>
Always returns <const>true</const>.
<p/>
</desc>
</method>
<p/>
<method name="to_a" ref="to_a">
<callseq>
<tt>nil</tt>.to_a <returns>[]</returns>
</callseq>
<desc>
<p/>
Always returns an empty array.
<p/>
</desc>
</method>
<p/>
<method name="to_i" ref="to_i">
<callseq>
<tt>nil</tt>.to_i <returns>0</returns>
</callseq>
<desc>
<p/>
Always returns zero.
<p/>
</desc>
</method>
<p/>
<method name="to_s" ref="to_s">
<callseq>
<tt>nil</tt>.to_s <returns>""</returns>
</callseq>
<desc>
<p/>
Always returns the empty string.
<p/>
</desc>
</method>
<p/>
</methods>
<p/>
</class>
</ppdoc>
|