ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/ruby18/share/ri/1.8/system/Comparable/
Upload File :
Current File : //proc/thread-self/root/opt/alt/ruby18/share/ri/1.8/system/Comparable/cdesc-Comparable.yaml

--- !ruby/object:RI::ClassDescription 
attributes: []

class_methods: []

comment: 
- !ruby/struct:SM::Flow::P 
  body: The <tt>Comparable</tt> mixin is used by classes whose objects may be ordered. The class must define the <tt>&lt;=&gt;</tt> operator, which compares the receiver against another object, returning -1, 0, or +1 depending on whether the receiver is less than, equal to, or greater than the other object. <tt>Comparable</tt> uses <tt>&lt;=&gt;</tt> to implement the conventional comparison operators (<tt>&lt;</tt>, <tt>&lt;=</tt>, <tt>==</tt>, <tt>&gt;=</tt>, and <tt>&gt;</tt>) and the method <tt>between?</tt>.
- !ruby/struct:SM::Flow::VERB 
  body: "   class SizeMatters\n     include Comparable\n     attr :str\n     def &lt;=&gt;(anOther)\n       str.size &lt;=&gt; anOther.str.size\n     end\n     def initialize(str)\n       @str = str\n     end\n     def inspect\n       @str\n     end\n   end\n\n   s1 = SizeMatters.new(&quot;Z&quot;)\n   s2 = SizeMatters.new(&quot;YY&quot;)\n   s3 = SizeMatters.new(&quot;XXX&quot;)\n   s4 = SizeMatters.new(&quot;WWWW&quot;)\n   s5 = SizeMatters.new(&quot;VVVVV&quot;)\n\n   s1 &lt; s2                       #=&gt; true\n   s4.between?(s1, s3)           #=&gt; false\n   s4.between?(s3, s5)           #=&gt; true\n   [ s3, s2, s5, s4, s1 ].sort   #=&gt; [Z, YY, XXX, WWWW, VVVVV]\n"
constants: []

full_name: Comparable
includes: []

instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: <
- !ruby/object:RI::MethodSummary 
  name: <=
- !ruby/object:RI::MethodSummary 
  name: ==
- !ruby/object:RI::MethodSummary 
  name: ">"
- !ruby/object:RI::MethodSummary 
  name: ">="
- !ruby/object:RI::MethodSummary 
  name: between?
name: Comparable
superclass: 

Zerion Mini Shell 1.0