mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
docs(compar.c): change class name in example
This commit is contained in:
parent
91b0d5fa38
commit
e5e53ee173
1 changed files with 9 additions and 6 deletions
15
compar.c
15
compar.c
|
@ -263,25 +263,28 @@ cmp_clamp(int argc, VALUE *argv, VALUE x)
|
||||||
* <code>==</code>, <code>>=</code>, and <code>></code>) and the
|
* <code>==</code>, <code>>=</code>, and <code>></code>) and the
|
||||||
* method <code>between?</code>.
|
* method <code>between?</code>.
|
||||||
*
|
*
|
||||||
* class SizeMatters
|
* class StringSorter
|
||||||
* include Comparable
|
* include Comparable
|
||||||
|
*
|
||||||
* attr :str
|
* attr :str
|
||||||
* def <=>(other)
|
* def <=>(other)
|
||||||
* str.size <=> other.str.size
|
* str.size <=> other.str.size
|
||||||
* end
|
* end
|
||||||
|
*
|
||||||
* def initialize(str)
|
* def initialize(str)
|
||||||
* @str = str
|
* @str = str
|
||||||
* end
|
* end
|
||||||
|
*
|
||||||
* def inspect
|
* def inspect
|
||||||
* @str
|
* @str
|
||||||
* end
|
* end
|
||||||
* end
|
* end
|
||||||
*
|
*
|
||||||
* s1 = SizeMatters.new("Z")
|
* s1 = StringSorter.new("Z")
|
||||||
* s2 = SizeMatters.new("YY")
|
* s2 = StringSorter.new("YY")
|
||||||
* s3 = SizeMatters.new("XXX")
|
* s3 = StringSorter.new("XXX")
|
||||||
* s4 = SizeMatters.new("WWWW")
|
* s4 = StringSorter.new("WWWW")
|
||||||
* s5 = SizeMatters.new("VVVVV")
|
* s5 = StringSorter.new("VVVVV")
|
||||||
*
|
*
|
||||||
* s1 < s2 #=> true
|
* s1 < s2 #=> true
|
||||||
* s4.between?(s1, s3) #=> false
|
* s4.between?(s1, s3) #=> false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue