Skip to content

Commit

Permalink
remove warning Fixnum is deprecated
Browse files Browse the repository at this point in the history
Ruby2.4 unify Fixnum and Bignum into Integer
https://bugs.ruby-lang.org/issues/12005
  • Loading branch information
takkanm authored and translunar committed Dec 20, 2017
1 parent 517b86b commit 293e2fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/nmatrix/io/mat5_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def initialize(stream = nil, byte_order = nil, content_or_bytes = nil)
if content_or_bytes.is_a?(String)
@content = content_or_bytes

elsif content_or_bytes.is_a?(Fixnum)
elsif content_or_bytes.is_a?(Integer)
@padded_bytes = content_or_bytes
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/nmatrix/monkeys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Array
# You must provide a shape for the matrix as the first argument.
#
# == Arguments:
# <tt>shape</tt> :: Array describing matrix dimensions (or Fixnum for square).
# <tt>shape</tt> :: Array describing matrix dimensions (or Integer for square).
# If not provided, will be intuited through #shape.
# <tt>dtype</tt> :: Override data type (e.g., to store a Float as :float32
# instead of :float64) -- optional.
Expand All @@ -46,7 +46,7 @@ def to_nm(shape = nil, dtype = nil, stype = :dense)

guess_dtype = ->(type) {
case type
when Fixnum then :int64
when Integer then :int64
when Float then :float64
when Complex then :complex128
end
Expand Down
14 changes: 7 additions & 7 deletions lib/nmatrix/nmatrix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def pretty_print(q) #:nodoc:
#
# If your dtype is :object and you are converting from :dense to a sparse type, it is recommended that you
# provide a :default, as 0 may behave differently from its Float or Complex equivalent. If no option
# is given, Fixnum 0 will be used.
# is given, Integer 0 will be used.
def cast(*params)
if (params.size > 0 && params[0].is_a?(Hash))
opts = {
Expand Down Expand Up @@ -419,7 +419,7 @@ def to_flat_array

#
# call-seq:
# size -> Fixnum
# size -> Integer
#
# Returns the total size of the NMatrix based on its shape.
#
Expand Down Expand Up @@ -566,12 +566,12 @@ def last
# the new and old shapes' components must be equal.
#
# * *Arguments* :
# - +new_shape+ -> Array of positive Fixnums.
# - +new_shape+ -> Array of positive Integers.
# * *Returns* :
# - A copy with a different shape.
#
def reshape new_shape,*shapes
if new_shape.is_a?Fixnum
if new_shape.is_a?Integer
newer_shape = [new_shape]+shapes
else # new_shape is an Array
newer_shape = new_shape
Expand All @@ -593,13 +593,13 @@ def reshape new_shape,*shapes
# the new and old shapes' components must be equal.
#
# * *Arguments* :
# - +new_shape+ -> Array of positive Fixnums.
# - +new_shape+ -> Array of positive Integer.
#
def reshape! new_shape,*shapes
if self.is_ref?
raise(ArgumentError, "This operation cannot be performed on reference slices")
else
if new_shape.is_a?Fixnum
if new_shape.is_a?Integer
shape = [new_shape]+shapes
else # new_shape is an Array
shape = new_shape
Expand Down Expand Up @@ -690,7 +690,7 @@ def transpose(permute = nil)
#
# * *Arguments* :
# - +matrices+ -> one or more matrices
# - +rank+ -> Fixnum (for rank); alternatively, may use :row, :column, or
# - +rank+ -> Integer (for rank); alternatively, may use :row, :column, or
# :layer for 0, 1, 2, respectively
def concat(*matrices)
rank = nil
Expand Down

0 comments on commit 293e2fb

Please sign in to comment.