[前][次][番号順一覧][スレッド一覧]

ruby-changes:45613

From: kazu <ko1@a...>
Date: Thu, 23 Feb 2017 00:46:48 +0900 (JST)
Subject: [ruby-changes:45613] kazu:r57686 (trunk): rational.c: fix rdoc

kazu	2017-02-23 00:46:43 +0900 (Thu, 23 Feb 2017)

  New Revision: 57686

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57686

  Log:
    rational.c: fix rdoc
    
    * rational.c: [DOC] fix wrong indentations and comment out some lines
      in code examples to make them valid Ruby code and syntax highlighted
      on the rendered page.
    
    [ci skip] [ruby-core:79607] [Bug #13233]
    Author:    Marcus Stollsteimer <sto.mar@w...>

  Modified files:
    trunk/rational.c
Index: rational.c
===================================================================
--- rational.c	(revision 57685)
+++ rational.c	(revision 57686)
@@ -1252,8 +1252,8 @@ nurat_negative_p(VALUE self) https://github.com/ruby/ruby/blob/trunk/rational.c#L1252
  *
  *  Returns the absolute value of +rat+.
  *
- *  (1/2r).abs    #=> 1/2r
- *  (-1/2r).abs   #=> 1/2r
+ *     (1/2r).abs    #=> 1/2r
+ *     (-1/2r).abs   #=> 1/2r
  *
  *  Rational#magnitude is an alias of Rational#abs.
  */
@@ -1289,8 +1289,7 @@ nurat_ceil(VALUE self) https://github.com/ruby/ruby/blob/trunk/rational.c#L1289
  *
  * Returns the truncated value as an integer.
  *
- * Equivalent to
- *    rat.truncate.
+ * Equivalent to Rational#truncate.
  *
  *    Rational(2, 3).to_i   #=> 0
  *    Rational(3).to_i      #=> 3
@@ -1430,9 +1429,9 @@ f_round_common(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/rational.c#L1429
  *    Rational(2, 3).floor   #=> 0
  *    Rational(-3, 2).floor  #=> -1
  *
- *           decimal      -  1  2  3 . 4  5  6
- *                          ^  ^  ^  ^   ^  ^
- *          precision      -3 -2 -1  0  +1 +2
+ *      #    decimal      -  1  2  3 . 4  5  6
+ *      #                   ^  ^  ^  ^   ^  ^
+ *      #   precision      -3 -2 -1  0  +1 +2
  *
  *    '%f' % Rational('-123.456').floor(+1)  #=> "-123.500000"
  *    '%f' % Rational('-123.456').floor(-1)  #=> "-130.000000"
@@ -1454,9 +1453,9 @@ nurat_floor_n(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/rational.c#L1453
  *    Rational(2, 3).ceil   #=> 1
  *    Rational(-3, 2).ceil  #=> -1
  *
- *           decimal      -  1  2  3 . 4  5  6
- *                          ^  ^  ^  ^   ^  ^
- *          precision      -3 -2 -1  0  +1 +2
+ *      #    decimal      -  1  2  3 . 4  5  6
+ *      #                   ^  ^  ^  ^   ^  ^
+ *      #   precision      -3 -2 -1  0  +1 +2
  *
  *    '%f' % Rational('-123.456').ceil(+1)  #=> "-123.400000"
  *    '%f' % Rational('-123.456').ceil(-1)  #=> "-120.000000"
@@ -1478,9 +1477,9 @@ nurat_ceil_n(int argc, VALUE *argv, VALU https://github.com/ruby/ruby/blob/trunk/rational.c#L1477
  *    Rational(2, 3).truncate   #=> 0
  *    Rational(-3, 2).truncate  #=> -1
  *
- *           decimal      -  1  2  3 . 4  5  6
- *                          ^  ^  ^  ^   ^  ^
- *          precision      -3 -2 -1  0  +1 +2
+ *      #    decimal      -  1  2  3 . 4  5  6
+ *      #                   ^  ^  ^  ^   ^  ^
+ *      #   precision      -3 -2 -1  0  +1 +2
  *
  *    '%f' % Rational('-123.456').truncate(+1)  #=>  "-123.400000"
  *    '%f' % Rational('-123.456').truncate(-1)  #=>  "-120.000000"
@@ -1503,9 +1502,9 @@ nurat_truncate_n(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/rational.c#L1502
  *    Rational(2, 3).round   #=> 1
  *    Rational(-3, 2).round  #=> -2
  *
- *           decimal      -  1  2  3 . 4  5  6
- *                          ^  ^  ^  ^   ^  ^
- *          precision      -3 -2 -1  0  +1 +2
+ *      #    decimal      -  1  2  3 . 4  5  6
+ *      #                   ^  ^  ^  ^   ^  ^
+ *      #   precision      -3 -2 -1  0  +1 +2
  *
  *    '%f' % Rational('-123.456').round(+1)  #=> "-123.500000"
  *    '%f' % Rational('-123.456').round(-1)  #=> "-120.000000"

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]