Skip to content

Commit 293e2fb

Browse files
takkanmtranslunar
authored andcommitted
remove warning Fixnum is deprecated
Ruby2.4 unify Fixnum and Bignum into Integer https://bugs.ruby-lang.org/issues/12005
1 parent 517b86b commit 293e2fb

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/nmatrix/io/mat5_reader.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def initialize(stream = nil, byte_order = nil, content_or_bytes = nil)
4747
if content_or_bytes.is_a?(String)
4848
@content = content_or_bytes
4949

50-
elsif content_or_bytes.is_a?(Fixnum)
50+
elsif content_or_bytes.is_a?(Integer)
5151
@padded_bytes = content_or_bytes
5252
end
5353
end

lib/nmatrix/monkeys.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Array
3636
# You must provide a shape for the matrix as the first argument.
3737
#
3838
# == Arguments:
39-
# <tt>shape</tt> :: Array describing matrix dimensions (or Fixnum for square).
39+
# <tt>shape</tt> :: Array describing matrix dimensions (or Integer for square).
4040
# If not provided, will be intuited through #shape.
4141
# <tt>dtype</tt> :: Override data type (e.g., to store a Float as :float32
4242
# instead of :float64) -- optional.
@@ -46,7 +46,7 @@ def to_nm(shape = nil, dtype = nil, stype = :dense)
4646

4747
guess_dtype = ->(type) {
4848
case type
49-
when Fixnum then :int64
49+
when Integer then :int64
5050
when Float then :float64
5151
when Complex then :complex128
5252
end

lib/nmatrix/nmatrix.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def pretty_print(q) #:nodoc:
235235
#
236236
# If your dtype is :object and you are converting from :dense to a sparse type, it is recommended that you
237237
# provide a :default, as 0 may behave differently from its Float or Complex equivalent. If no option
238-
# is given, Fixnum 0 will be used.
238+
# is given, Integer 0 will be used.
239239
def cast(*params)
240240
if (params.size > 0 && params[0].is_a?(Hash))
241241
opts = {
@@ -419,7 +419,7 @@ def to_flat_array
419419

420420
#
421421
# call-seq:
422-
# size -> Fixnum
422+
# size -> Integer
423423
#
424424
# Returns the total size of the NMatrix based on its shape.
425425
#
@@ -566,12 +566,12 @@ def last
566566
# the new and old shapes' components must be equal.
567567
#
568568
# * *Arguments* :
569-
# - +new_shape+ -> Array of positive Fixnums.
569+
# - +new_shape+ -> Array of positive Integers.
570570
# * *Returns* :
571571
# - A copy with a different shape.
572572
#
573573
def reshape new_shape,*shapes
574-
if new_shape.is_a?Fixnum
574+
if new_shape.is_a?Integer
575575
newer_shape = [new_shape]+shapes
576576
else # new_shape is an Array
577577
newer_shape = new_shape
@@ -593,13 +593,13 @@ def reshape new_shape,*shapes
593593
# the new and old shapes' components must be equal.
594594
#
595595
# * *Arguments* :
596-
# - +new_shape+ -> Array of positive Fixnums.
596+
# - +new_shape+ -> Array of positive Integer.
597597
#
598598
def reshape! new_shape,*shapes
599599
if self.is_ref?
600600
raise(ArgumentError, "This operation cannot be performed on reference slices")
601601
else
602-
if new_shape.is_a?Fixnum
602+
if new_shape.is_a?Integer
603603
shape = [new_shape]+shapes
604604
else # new_shape is an Array
605605
shape = new_shape
@@ -690,7 +690,7 @@ def transpose(permute = nil)
690690
#
691691
# * *Arguments* :
692692
# - +matrices+ -> one or more matrices
693-
# - +rank+ -> Fixnum (for rank); alternatively, may use :row, :column, or
693+
# - +rank+ -> Integer (for rank); alternatively, may use :row, :column, or
694694
# :layer for 0, 1, 2, respectively
695695
def concat(*matrices)
696696
rank = nil

0 commit comments

Comments
 (0)