Show me a definitive, peer-reviewed/maintained Ruby precedence table (of operators, non-operators, and modifiers).
Over the years I have had to rely on the following sources for this information:
1. http://phrogz.net/programmingruby/language.html#table_18.4 - The Pickaxe book, which documents Ruby 1.6
, which was released in September 2000, and includes a formatting error or typo ({
is listed as an assignment operator).
2. http://www.techotopia.com/index.php/Ruby_Operator_Precedence - A near copy of the above Pickaxe table, including the erroneous {
, and accidentally describes ||
as Logical 'AND'.
3. http://www.tutorialspoint.com/ruby/ruby_operators.htm - Also a near copy of the Pickaxe table, though it fixes the description of ||
to Logical 'OR', yet it still lists {
as an assignment operator. As well, it lists ::
and incorrectly describes it as a constant resolution operator (::
is not an operator).
4. http://my.safaribooksonline.com/book/web-development/ruby/9780596516178/expressions-and-operators/operators - The Ruby Programming Language book, which documents Ruby 1.8
and 1.9
, which were released in August 2003 and December 2007, respectively. This book was published in 2008 by David Flanagan and Yukihiro Matsumoto (aka "Matz", the inventor of Ruby). It seems to be the most up-to-date and accurate list of operators, non-operators, modifiers, and supporting information. Incidentally, around 2005, interest in Ruby surged in tandem with Rails, which was released in July 2004.
5. http://romhack.wikia.com/wiki/Ruby_operators - Also documents operators in Ruby 1.9
, and includes non-operators and modifiers in its table.
Ruby 2.0
was released in February 2013, and was intended to be fully backward compatible with Ruby 1.9.3
. Of the few known incompatibilities, none are related to operators.
Ruby 2.1.0
was released on Christmas Day in 2013
, and similarly, no operator incompatibilities are listed.
Thus, I decided to include an answer, based on the Flanagan/Matz book, and made it a community wiki.
Question&Answers:
os