Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs for Enumerable and Comparable are not working #26

Open
kyrylo opened this issue Feb 27, 2015 · 0 comments
Open

Docs for Enumerable and Comparable are not working #26

kyrylo opened this issue Feb 27, 2015 · 0 comments

Comments

@kyrylo
Copy link
Member

kyrylo commented Feb 27, 2015

[12] pry(main)> $ Comparable                                                                                                                                                                                                                                                                                                                                                 
Error: Couldn't locate a definition for Comparable!
[16] pry(main)> YARD::Registry.at('Comparable').docstring
=> "The <code>Comparable</code> mixin is used by classes whose objects\nmay be ordered. The class must define the <code><=></code> operator,\nwhich compares the receiver against another object, returning -1, 0,\nor +1 depending on whether the receiver is less than, equal to, or\ngreater than the other object. If the other object is not comparable\nthen the <code><=></code> operator should return nil.\n<code>Comparable</code> uses\n<code><=></code> to implement the conventional comparison operators\n(<code><</code>, <code><=</code>, <code>==</code>, <code>>=</code>,\nand <code>></code>) and the method <code>between?</code>.\n\n   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]"
[17] pry(main)> 
[17] pry(main)> pry-version
Pry version: 0.10.1 on Ruby 2.2.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant