Skip to content

Commit 934deed

Browse files
committed
Minimal changes to avoid Fixnum deprecation warnings
Notably, this does not revise the documentation to match.
1 parent dfe645a commit 934deed

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

lib/concurrent/atomic/cyclic_barrier.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class CyclicBarrier < Synchronization::LockableObject
1818
#
1919
# @raise [ArgumentError] if `parties` is not an integer or is less than zero
2020
def initialize(parties, &block)
21-
if !parties.is_a?(Fixnum) || parties < 1
21+
if !parties.is_a?(Integer) || parties < 1
2222
raise ArgumentError.new('count must be in integer greater than or equal zero')
2323
end
2424
super(&nil)

lib/concurrent/atomic/mutex_atomic_fixnum.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ def ns_set(value)
7777

7878
# @!visibility private
7979
def range_check!(value)
80-
if !value.is_a?(Fixnum)
81-
raise ArgumentError.new('value value must be a Fixnum')
80+
if !value.is_a?(Integer)
81+
raise ArgumentError.new('value must be an Integer')
8282
elsif value > MAX_VALUE
8383
raise RangeError.new("#{value} is greater than the maximum value of #{MAX_VALUE}")
8484
elsif value < MIN_VALUE

lib/concurrent/atomic/mutex_count_down_latch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class MutexCountDownLatch < Synchronization::LockableObject
99

1010
# @!macro count_down_latch_method_initialize
1111
def initialize(count = 1)
12-
unless count.is_a?(Fixnum) && count >= 0
12+
unless count.is_a?(Integer) && count >= 0
1313
raise ArgumentError.new('count must be in integer greater than or equal zero')
1414
end
1515
super()

lib/concurrent/atomic/mutex_semaphore.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class MutexSemaphore < Synchronization::LockableObject
99

1010
# @!macro semaphore_method_initialize
1111
def initialize(count)
12-
unless count.is_a?(Fixnum) && count >= 0
12+
unless count.is_a?(Integer) && count >= 0
1313
fail ArgumentError, 'count must be an non-negative integer'
1414
end
1515
super()
@@ -18,7 +18,7 @@ def initialize(count)
1818

1919
# @!macro semaphore_method_acquire
2020
def acquire(permits = 1)
21-
unless permits.is_a?(Fixnum) && permits > 0
21+
unless permits.is_a?(Integer) && permits > 0
2222
fail ArgumentError, 'permits must be an integer greater than zero'
2323
end
2424
synchronize do
@@ -45,7 +45,7 @@ def drain_permits
4545

4646
# @!macro semaphore_method_try_acquire
4747
def try_acquire(permits = 1, timeout = nil)
48-
unless permits.is_a?(Fixnum) && permits > 0
48+
unless permits.is_a?(Integer) && permits > 0
4949
fail ArgumentError, 'permits must be an integer greater than zero'
5050
end
5151
synchronize do
@@ -59,7 +59,7 @@ def try_acquire(permits = 1, timeout = nil)
5959

6060
# @!macro semaphore_method_release
6161
def release(permits = 1)
62-
unless permits.is_a?(Fixnum) && permits > 0
62+
unless permits.is_a?(Integer) && permits > 0
6363
fail ArgumentError, 'permits must be an integer greater than zero'
6464
end
6565
synchronize do
@@ -81,7 +81,7 @@ def release(permits = 1)
8181
#
8282
# @!visibility private
8383
def reduce_permits(reduction)
84-
unless reduction.is_a?(Fixnum) && reduction >= 0
84+
unless reduction.is_a?(Integer) && reduction >= 0
8585
fail ArgumentError, 'reduction must be an non-negative integer'
8686
end
8787
synchronize { @free -= reduction }

lib/concurrent/map.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def marshal_load(hash)
203203
undef :freeze
204204

205205
# @!visibility private
206-
DEFAULT_OBJ_ID_STR_WIDTH = (2**50).class == Fixnum ? 14 : 7 # we want to look "native", 7 for 32-bit, 14 for 64-bit
206+
DEFAULT_OBJ_ID_STR_WIDTH = 0.size == 4 ? 7 : 14 # we want to look "native", 7 for 32-bit, 14 for 64-bit
207207
# override default #inspect() method: firstly, we don't want to be spilling our guts (i-vars), secondly, MRI backend's
208208
# #inspect() call on its @backend i-var will bump @backend's iter level while possibly yielding GVL
209209
def inspect
@@ -227,8 +227,8 @@ def populate_from(hash)
227227
end
228228

229229
def validate_options_hash!(options)
230-
if (initial_capacity = options[:initial_capacity]) && (!initial_capacity.kind_of?(Fixnum) || initial_capacity < 0)
231-
raise ArgumentError, ":initial_capacity must be a positive Fixnum"
230+
if (initial_capacity = options[:initial_capacity]) && (!initial_capacity.kind_of?(Integer) || initial_capacity < 0)
231+
raise ArgumentError, ":initial_capacity must be a positive Integer"
232232
end
233233
if (load_factor = options[:load_factor]) && (!load_factor.kind_of?(Numeric) || load_factor <= 0 || load_factor > 1)
234234
raise ArgumentError, ":load_factor must be a number between 0 and 1"

spec/concurrent/edge/future_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
c = Concurrent.future { raise 'c' }
203203

204204
Concurrent.zip(a, b, c).chain { |*args| q << args }
205-
expect(q.pop.flatten.map(&:class)).to eq [FalseClass, Fixnum, NilClass, NilClass, NilClass, RuntimeError, RuntimeError]
205+
expect(q.pop.flatten.map(&:class)).to eq [FalseClass, 1.class, NilClass, NilClass, NilClass, RuntimeError, RuntimeError]
206206
Concurrent.zip(a, b, c).rescue { |*args| q << args }
207207
expect(q.pop.map(&:class)).to eq [NilClass, RuntimeError, RuntimeError]
208208

0 commit comments

Comments
 (0)