Server IP : 66.29.132.122 / Your IP : 18.226.4.248 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/opt/alt/ruby18/share/ri/1.8/system/Comparable/ |
Upload File : |
--- !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><=></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><=></tt> to implement the conventional comparison operators (<tt><</tt>, <tt><=</tt>, <tt>==</tt>, <tt>>=</tt>, and <tt>></tt>) and the method <tt>between?</tt>. - !ruby/struct:SM::Flow::VERB body: " class SizeMatters\n include Comparable\n attr :str\n def <=>(anOther)\n str.size <=> 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("Z")\n s2 = SizeMatters.new("YY")\n s3 = SizeMatters.new("XXX")\n s4 = SizeMatters.new("WWWW")\n s5 = SizeMatters.new("VVVVV")\n\n s1 < s2 #=> true\n s4.between?(s1, s3) #=> false\n s4.between?(s3, s5) #=> true\n [ s3, s2, s5, s4, s1 ].sort #=> [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: