1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[DOC] replace Fixnum with Integer [ci skip]

* 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
This commit is contained in:
nobu 2016-10-26 06:11:23 +00:00
parent 6c4903ce2c
commit 4e44f6ef86
18 changed files with 51 additions and 75 deletions

View file

@ -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
*/

View file

@ -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>
*

View file

@ -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.
*/
@ -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.
*
@ -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.

View file

@ -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+.
*

View file

@ -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()
*/

View file

@ -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

View file

@ -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

View file

@ -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

2
hash.c
View file

@ -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
*/

12
io.c
View file

@ -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
*/
@ -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.
@ -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:
@ -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
@ -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

2
math.c
View file

@ -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

View file

@ -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
@ -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
@ -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.
*
*/
@ -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
@ -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
*/
@ -3325,7 +3311,6 @@ rb_int2str(VALUE x, int base)
/*
* Document-method: Integer#+
* Document-method: Fixnum#+
* call-seq:
* int + numeric -> numeric_result
*
@ -3381,7 +3366,6 @@ rb_int_plus(VALUE x, VALUE y)
/*
* Document-method: Integer#-
* Document-method: Fixnum#-
* call-seq:
* int - numeric -> numeric_result
*
@ -3434,7 +3418,6 @@ rb_int_minus(VALUE x, VALUE y)
/*
* Document-method: Integer#*
* Document-method: Fixnum#*
* call-seq:
* int * numeric -> numeric_result
*
@ -3521,7 +3504,6 @@ int_fdiv(VALUE x, VALUE y)
/*
* Document-method: Integer#/
* Document-method: Fixnum#/
* call-seq:
* int / numeric -> numeric_result
*
@ -3609,7 +3591,6 @@ rb_int_idiv(VALUE x, VALUE y)
}
/*
* Document-method: Fixnum#%
* Document-method: Integer#%
* Document-method: Integer#modulo
* call-seq:
@ -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)
@ -3864,7 +3845,6 @@ rb_int_pow(VALUE x, VALUE y)
/*
* Document-method: Integer#==
* Document-method: Fixnum#==
* call-seq:
* int == other -> true or false
*
@ -3958,7 +3938,6 @@ int_cmp(VALUE x, VALUE y)
/*
* Document-method: Integer#>
* Document-method: Fixnum#>
* call-seq:
* int > real -> true or false
*
@ -3997,7 +3976,6 @@ int_gt(VALUE x, VALUE y)
/*
* Document-method: Integer#>=
* Document-method: Fixnum#>=
* call-seq:
* int >= real -> true or false
*
@ -4038,7 +4016,6 @@ rb_int_ge(VALUE x, VALUE y)
/*
* Document-method: Integer#<
* Document-method: Fixnum#<
* call-seq:
* int < real -> true or false
*
@ -4077,7 +4054,6 @@ int_lt(VALUE x, VALUE y)
/*
* Document-method: Integer#<=
* Document-method: Fixnum#<=
* call-seq:
* int <= real -> true or false
*
@ -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.
*

View file

@ -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
@ -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
*/
@ -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>
@ -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
@ -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>,

4
proc.c
View file

@ -1087,7 +1087,7 @@ iseq_location(const rb_iseq_t *iseq)
/*
* call-seq:
* prc.source_location -> [String, Fixnum]
* prc.source_location -> [String, Integer]
*
* Returns the Ruby source filename and line number containing this proc
* or +nil+ if this proc was not defined in Ruby (i.e. native)
@ -2472,7 +2472,7 @@ rb_obj_method_location(VALUE obj, ID id)
/*
* call-seq:
* meth.source_location -> [String, Fixnum]
* meth.source_location -> [String, Integer]
*
* Returns the Ruby source filename and line number containing this method
* or nil if this method was not defined in Ruby (i.e. native)

View file

@ -501,7 +501,7 @@ rb_last_status_clear(void)
* stat.to_i -> integer
* stat.to_int -> integer
*
* Returns the bits in _stat_ as a <code>Fixnum</code>. Poking
* Returns the bits in _stat_ as a <code>Integer</code>. Poking
* around in these bits is platform dependent.
*
* fork { exit 0xab } #=> 26566

2
re.c
View file

@ -3292,7 +3292,7 @@ rb_reg_match_m_p(int argc, VALUE *argv, VALUE re)
* String or a Regexp (in which case that regexp's options are propagated),
* and new options may not be specified (a change as of Ruby 1.8).
*
* If +options+ is a Fixnum, it should be one or more of the constants
* If +options+ is an Integer, it should be one or more of the constants
* Regexp::EXTENDED, Regexp::IGNORECASE, and Regexp::MULTILINE,
* <em>or</em>-ed together. Otherwise, if +options+ is not
* +nil+ or +false+, the regexp will be case insensitive.

View file

@ -4423,10 +4423,10 @@ rb_str_aset(VALUE str, VALUE indx, VALUE val)
* the text it is replacing, the string will be adjusted accordingly. If the
* regular expression or string is used as the index doesn't match a position
* in the string, <code>IndexError</code> is raised. If the regular expression
* form is used, the optional second <code>Fixnum</code> allows you to specify
* form is used, the optional second <code>Integer</code> allows you to specify
* which portion of the match to replace (effectively using the
* <code>MatchData</code> indexing rules. The forms that take a
* <code>Fixnum</code> will raise an <code>IndexError</code> if the value is
* <code>MatchData</code> indexing rules. The forms that take an
* <code>Integer</code> will raise an <code>IndexError</code> if the value is
* out of range; the <code>Range</code> form will raise a
* <code>RangeError</code>, and the <code>Regexp</code> and <code>String</code>
* will raise an <code>IndexError</code> on negative match.
@ -5196,8 +5196,8 @@ str_byte_aref(VALUE str, VALUE indx)
* str.byteslice(integer, integer) -> new_str or nil
* str.byteslice(range) -> new_str or nil
*
* Byte Reference---If passed a single <code>Fixnum</code>, returns a
* substring of one byte at that position. If passed two <code>Fixnum</code>
* Byte Reference---If passed a single <code>Integer</code>, returns a
* substring of one byte at that position. If passed two <code>Integer</code>
* objects, returns a substring starting at the offset given by the first, and
* a length given by the second. If given a <code>Range</code>, a substring containing
* bytes at offsets given by the range is returned. In all three cases, if
@ -8521,7 +8521,7 @@ rb_str_ord(VALUE s)
* str.sum(n=16) -> integer
*
* Returns a basic <em>n</em>-bit checksum of the characters in <i>str</i>,
* where <em>n</em> is the optional <code>Fixnum</code> parameter, defaulting
* where <em>n</em> is the optional <code>Integer</code> parameter, defaulting
* to 16. The result is simply the sum of the binary value of each byte in
* <i>str</i> modulo <code>2**n - 1</code>. This is not a particularly good
* checksum.

View file

@ -1515,7 +1515,7 @@ native_set_thread_name(rb_thread_t *th)
SET_CURRENT_THREAD_NAME(RSTRING_PTR(loc));
}
else if (!NIL_P(loc = rb_proc_location(th->first_proc))) {
const VALUE *ptr = RARRAY_CONST_PTR(loc); /* [ String, Fixnum ] */
const VALUE *ptr = RARRAY_CONST_PTR(loc); /* [ String, Integer ] */
char *name, *p;
char buf[16];
size_t len;