Skip to content

Commit

Permalink
[DOC] replace Fixnum with Integer [ci skip]
Browse files Browse the repository at this point in the history
* numeric.c: [DOC] update document for Integer class.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Oct 26, 2016
1 parent 6c4903c commit 4e44f6e
Show file tree
Hide file tree
Showing 18 changed files with 51 additions and 75 deletions.
4 changes: 2 additions & 2 deletions bignum.c
Expand Up @@ -5443,8 +5443,8 @@ rb_big_le(VALUE x, VALUE y)
* big == obj -> true or false
*
* Returns <code>true</code> only if <i>obj</i> has the same value
* as <i>big</i>. Contrast this with <code>Bignum#eql?</code>, which
* requires <i>obj</i> to be a <code>Bignum</code>.
* as <i>big</i>. Contrast this with <code>Integer#eql?</code>, which
* requires <i>obj</i> to be a <code>Integer</code>.
*
* 68719476736 == 68719476736.0 #=> true
*/
Expand Down
2 changes: 1 addition & 1 deletion error.c
Expand Up @@ -1816,7 +1816,7 @@ syserr_eqq(VALUE self, VALUE exc)
*
* Since constant names must start with a capital:
*
* Fixnum.const_set :answer, 42
* Integer.const_set :answer, 42
*
* <em>raises the exception:</em>
*
Expand Down
8 changes: 4 additions & 4 deletions ext/bigdecimal/bigdecimal.c
Expand Up @@ -680,7 +680,7 @@ BigDecimal_check_num(Real *p)

static VALUE BigDecimal_split(VALUE self);

/* Returns the value as an integer (Fixnum or Bignum).
/* Returns the value as an Integer.
*
* If the BigNumber is infinity or NaN, raises FloatDomainError.
*/
Expand Down Expand Up @@ -2483,7 +2483,7 @@ static Real *BigDecimal_new(int argc, VALUE *argv);
* If it is a String, spaces are ignored and unrecognized characters
* terminate the value.
*
* digits:: The number of significant digits, as a Fixnum. If omitted or 0,
* digits:: The number of significant digits, as an Integer. If omitted or 0,
* the number of significant digits is determined from the initial
* value.
*
Expand All @@ -2492,10 +2492,10 @@ static Real *BigDecimal_new(int argc, VALUE *argv);
*
* ==== Exceptions
*
* TypeError:: If the +initial+ type is neither Fixnum, Bignum, Float,
* TypeError:: If the +initial+ type is neither Integer, Float,
* Rational, nor BigDecimal, this exception is raised.
*
* TypeError:: If the +digits+ is not a Fixnum, this exception is raised.
* TypeError:: If the +digits+ is not an Integer, this exception is raised.
*
* ArgumentError:: If +initial+ is a Float, and the +digits+ is larger than
* Float::DIG + 1, this exception is raised.
Expand Down
2 changes: 1 addition & 1 deletion ext/objspace/object_tracing.c
Expand Up @@ -439,7 +439,7 @@ allocation_method_id(VALUE self, VALUE obj)
}

/*
* call-seq: allocation_generation(object) -> Fixnum
* call-seq: allocation_generation(object) -> integer or nil
*
* Returns garbage collector generation for the given +object+.
*
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/ossl_pkey_ec.c
Expand Up @@ -1191,7 +1191,7 @@ static VALUE ossl_ec_group_set_seed(VALUE self, VALUE seed)

/*
* call-seq:
* group.degree => Fixnum
* group.degree => integer
*
* See the OpenSSL documentation for EC_GROUP_get_degree()
*/
Expand Down
4 changes: 2 additions & 2 deletions ext/socket/basicsocket.c
Expand Up @@ -158,10 +158,10 @@ bsock_close_write(VALUE sock)
* * +optval+ is the value of the option, it is passed to the underlying
* setsockopt() as a pointer to a certain number of bytes. How this is
* done depends on the type:
* - Fixnum: value is assigned to an int, and a pointer to the int is
* - Integer: value is assigned to an int, and a pointer to the int is
* passed, with length of sizeof(int).
* - true or false: 1 or 0 (respectively) is assigned to an int, and the
* int is passed as for a Fixnum. Note that +false+ must be passed,
* int is passed as for an Integer. Note that +false+ must be passed,
* not +nil+.
* - String: the string's data and length is passed to the socket.
* * +socketoption+ is an instance of Socket::Option
Expand Down
2 changes: 1 addition & 1 deletion ext/win32ole/win32ole_variant.c
Expand Up @@ -602,7 +602,7 @@ folevariant_ary_aset(int argc, VALUE *argv, VALUE self)
*
* Returns Ruby object value from OLE variant.
* obj = WIN32OLE_VARIANT.new(1, WIN32OLE::VARIANT::VT_BSTR)
* obj.value # => "1" (not Fixnum object, but String object "1")
* obj.value # => "1" (not Integer object, but String object "1")
*
*/
static VALUE
Expand Down
2 changes: 1 addition & 1 deletion ext/zlib/zlib.c
Expand Up @@ -3218,7 +3218,7 @@ rb_gzfile_set_lineno(VALUE obj, VALUE lineno)
* Document-method: Zlib::GzipWriter#mtime=
*
* Specify the modification time (+mtime+) in the gzip header.
* Using a Fixnum or Integer.
* Using an Integer.
*
* Setting the mtime in the gzip header does not effect the
* mtime of the file generated. Different utilities that
Expand Down
2 changes: 1 addition & 1 deletion hash.c
Expand Up @@ -2863,7 +2863,7 @@ rb_hash_any_p(VALUE hash)
*
* g = { foo: [10, 11, 12] }
* g.dig(:foo, 1) #=> 11
* g.dig(:foo, 1, 0) #=> TypeError: Fixnum does not have #dig method
* g.dig(:foo, 1, 0) #=> TypeError: Integer does not have #dig method
* g.dig(:foo, :bar) #=> TypeError: no implicit conversion of Symbol into Integer
*/

Expand Down
12 changes: 6 additions & 6 deletions io.c
Expand Up @@ -6441,7 +6441,7 @@ rb_io_s_open(int argc, VALUE *argv, VALUE klass)
* IO.sysopen(path, [mode, [perm]]) -> integer
*
* Opens the given path, returning the underlying file descriptor as a
* <code>Fixnum</code>.
* <code>Integer</code>.
*
* IO.sysopen("testfile") #=> 3
*/
Expand Down Expand Up @@ -11378,7 +11378,7 @@ argf_getc(VALUE argf)

/*
* call-seq:
* ARGF.getbyte -> Fixnum or nil
* ARGF.getbyte -> Integer or nil
*
* Gets the next 8-bit byte (0..255) from +ARGF+. Returns +nil+ if called at
* the end of the stream.
Expand Down Expand Up @@ -11458,9 +11458,9 @@ argf_readchar(VALUE argf)

/*
* call-seq:
* ARGF.readbyte -> Fixnum
* ARGF.readbyte -> Integer
*
* Reads the next 8-bit byte from ARGF and returns it as a +Fixnum+. Raises
* Reads the next 8-bit byte from ARGF and returns it as an +Integer+. Raises
* an +EOFError+ after the last byte of the last file has been read.
*
* For example:
Expand Down Expand Up @@ -11521,7 +11521,7 @@ argf_block_call(ID mid, int argc, VALUE *argv, VALUE argf)
* which defaults to your platform's newline character) of each file in
* +ARGV+. If a block is supplied, each line in turn will be yielded to the
* block, otherwise an enumerator is returned.
* The optional _limit_ argument is a +Fixnum+ specifying the maximum
* The optional _limit_ argument is an +Integer+ specifying the maximum
* length of each line; longer lines will be split according to this limit.
*
* This method allows you to treat the files supplied on the command line as
Expand Down Expand Up @@ -11571,7 +11571,7 @@ argf_lines(int argc, VALUE *argv, VALUE argf)
* ARGF.each_byte -> an_enumerator
*
* Iterates over each byte of each file in +ARGV+.
* A byte is returned as a +Fixnum+ in the range 0..255.
* A byte is returned as an +Integer+ in the range 0..255.
*
* This method allows you to treat the files supplied on the command line as
* a single file consisting of the concatenation of each named file. After
Expand Down
2 changes: 1 addition & 1 deletion math.c
Expand Up @@ -683,7 +683,7 @@ math_cbrt(VALUE obj, VALUE x)
* Math.frexp(x) -> [fraction, exponent]
*
* Returns a two-element array containing the normalized fraction (a Float)
* and exponent (a Fixnum) of +x+.
* and exponent (an Integer) of +x+.
*
* fraction, exponent = Math.frexp(1234) #=> [0.6025390625, 11]
* fraction * 2**exponent #=> 1234.0
Expand Down
48 changes: 12 additions & 36 deletions numeric.c
Expand Up @@ -669,7 +669,7 @@ num_real_p(VALUE num)
* call-seq:
* num.integer? -> true or false
*
* Returns +true+ if +num+ is an Integer (including Fixnum and Bignum).
* Returns +true+ if +num+ is an Integer.
*
* (1.0).integer? #=> false
* (1).integer? #=> true
Expand Down Expand Up @@ -787,8 +787,8 @@ num_infinite_p(VALUE num)
* Invokes the child class's +to_i+ method to convert +num+ to an integer.
*
* 1.0.class => Float
* 1.0.to_int.class => Fixnum
* 1.0.to_i.class => Fixnum
* 1.0.to_int.class => Integer
* 1.0.to_i.class => Integer
*/

static VALUE
Expand Down Expand Up @@ -2952,11 +2952,13 @@ rb_num2ull(VALUE val)

#endif /* HAVE_LONG_LONG */

/*
/********************************************************************
*
* Document-class: Integer
*
* This class is the basis for the two concrete classes that hold whole
* numbers, Bignum and Fixnum.
* Holds Integer values. You cannot add a singleton method to an
* Integer. Any attempt to add a singleton method to an Integer object
* will raise a TypeError.
*
*/

Expand Down Expand Up @@ -3039,8 +3041,6 @@ int_even_p(VALUE num)
/*
* Document-method: Integer#succ
* Document-method: Integer#next
* Document-method: Fixnum#succ
* Document-method: Fixnum#next
* call-seq:
* int.next -> integer
* int.succ -> integer
Expand Down Expand Up @@ -3192,22 +3192,8 @@ int_ord(VALUE num)
return num;
}

/********************************************************************
*
* Document-class: Fixnum
*
* Holds Integer values that can be represented in a native machine word
* (minus 1 bit). If any operation on a Fixnum exceeds this range, the value
* is automatically converted to a Bignum.
*
* Fixnum objects have immediate value. This means that when they are assigned
* or passed as parameters, the actual object is passed, rather than a
* reference to that object.
*
* Assignment does not alias Fixnum objects. There is effectively only one
* Fixnum object instance for any given integer value, so, for example, you
* cannot add a singleton method to a Fixnum. Any attempt to add a singleton
* method to a Fixnum object will raise a TypeError.
/*
* Fixnum
*/


Expand Down Expand Up @@ -3325,7 +3311,6 @@ rb_int2str(VALUE x, int base)

/*
* Document-method: Integer#+
* Document-method: Fixnum#+
* call-seq:
* int + numeric -> numeric_result
*
Expand Down Expand Up @@ -3381,7 +3366,6 @@ rb_int_plus(VALUE x, VALUE y)

/*
* Document-method: Integer#-
* Document-method: Fixnum#-
* call-seq:
* int - numeric -> numeric_result
*
Expand Down Expand Up @@ -3434,7 +3418,6 @@ rb_int_minus(VALUE x, VALUE y)

/*
* Document-method: Integer#*
* Document-method: Fixnum#*
* call-seq:
* int * numeric -> numeric_result
*
Expand Down Expand Up @@ -3521,7 +3504,6 @@ int_fdiv(VALUE x, VALUE y)

/*
* Document-method: Integer#/
* Document-method: Fixnum#/
* call-seq:
* int / numeric -> numeric_result
*
Expand Down Expand Up @@ -3609,7 +3591,6 @@ rb_int_idiv(VALUE x, VALUE y)
}

/*
* Document-method: Fixnum#%
* Document-method: Integer#%
* Document-method: Integer#modulo
* call-seq:
Expand Down Expand Up @@ -3741,7 +3722,7 @@ int_divmod(VALUE x, VALUE y)
*
* Raises +integer+ to the power of +numeric+, which may be negative or
* fractional.
* The result may be a Fixnum, Bignum, or Float
* The result may be an Integer, or a Float
*
* 2 ** 3 #=> 8
* 2 ** -1 #=> (1/2)
Expand Down Expand Up @@ -3864,7 +3845,6 @@ rb_int_pow(VALUE x, VALUE y)

/*
* Document-method: Integer#==
* Document-method: Fixnum#==
* call-seq:
* int == other -> true or false
*
Expand Down Expand Up @@ -3958,7 +3938,6 @@ int_cmp(VALUE x, VALUE y)

/*
* Document-method: Integer#>
* Document-method: Fixnum#>
* call-seq:
* int > real -> true or false
*
Expand Down Expand Up @@ -3997,7 +3976,6 @@ int_gt(VALUE x, VALUE y)

/*
* Document-method: Integer#>=
* Document-method: Fixnum#>=
* call-seq:
* int >= real -> true or false
*
Expand Down Expand Up @@ -4038,7 +4016,6 @@ rb_int_ge(VALUE x, VALUE y)

/*
* Document-method: Integer#<
* Document-method: Fixnum#<
* call-seq:
* int < real -> true or false
*
Expand Down Expand Up @@ -4077,7 +4054,6 @@ int_lt(VALUE x, VALUE y)

/*
* Document-method: Integer#<=
* Document-method: Fixnum#<=
* call-seq:
* int <= real -> true or false
*
Expand Down Expand Up @@ -5019,7 +4995,7 @@ int_truncate(int argc, VALUE* argv, VALUE num)
* by preventing instantiation and duplication.
*
* Integer.new(1) #=> NoMethodError: undefined method `new' for Integer:Class
* 1.dup #=> TypeError: can't dup Fixnum
* 1.dup #=> TypeError: can't dup Integer
*
* For this reason, Numeric should be used when defining other numeric classes.
*
Expand Down
14 changes: 7 additions & 7 deletions object.c
Expand Up @@ -147,12 +147,12 @@ rb_obj_equal(VALUE obj1, VALUE obj2)
* call-seq:
* obj.hash -> integer
*
* Generates a Fixnum hash value for this object. This function must have the
* Generates an Integer hash value for this object. This function must have the
* property that <code>a.eql?(b)</code> implies <code>a.hash == b.hash</code>.
*
* The hash value is used along with #eql? by the Hash class to determine if
* two objects reference the same hash key. Any hash value that exceeds the
* capacity of a Fixnum will be truncated before being used.
* capacity of an Integer will be truncated before being used.
*
* The hash value for an object may not be identical across invocations or
* implementations of Ruby. If you need a stable identifier across Ruby
Expand Down Expand Up @@ -221,7 +221,7 @@ rb_class_real(VALUE cl)
* called with an explicit receiver, as <code>class</code> is also a
* reserved word in Ruby.
*
* 1.class #=> Fixnum
* 1.class #=> Integer
* self.class #=> Object
*/

Expand All @@ -241,7 +241,7 @@ rb_obj_class(VALUE obj)
* If <i>obj</i> is <code>nil</code>, <code>true</code>, or
* <code>false</code>, it returns NilClass, TrueClass, or FalseClass,
* respectively.
* If <i>obj</i> is a Fixnum or a Symbol, it raises a TypeError.
* If <i>obj</i> is an Integer, a Float or a Symbol, it raises a TypeError.
*
* Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>>
* String.singleton_class #=> #<Class:String>
Expand Down Expand Up @@ -1087,8 +1087,8 @@ rb_obj_infect(VALUE obj1, VALUE obj2)
* prog.rb:3:in `<<': can't modify frozen Array (RuntimeError)
* from prog.rb:3
*
* Objects of the following classes are always frozen: Fixnum,
* Bignum, Float, Symbol.
* Objects of the following classes are always frozen: Integer,
* Float, Symbol.
*/

VALUE
Expand Down Expand Up @@ -2734,7 +2734,7 @@ rb_Integer(VALUE val)
* call-seq:
* Integer(arg, base=0) -> integer
*
* Converts <i>arg</i> to a <code>Fixnum</code> or <code>Bignum</code>.
* Converts <i>arg</i> to an <code>Integer</code>.
* Numeric types are converted directly (with floating point numbers
* being truncated). <i>base</i> (0, or between 2 and 36) is a base for
* integer string representation. If <i>arg</i> is a <code>String</code>,
Expand Down

0 comments on commit 4e44f6e

Please sign in to comment.