Module: Concurrent::Utility::NativeInteger Private
Do not use. This module is for internal use only.
Relationships & Source Files | |
Defined in: | lib/concurrent-ruby/concurrent/utility/native_integer.rb |
Constant Summary
-
MAX_VALUE =
# File 'lib/concurrent-ruby/concurrent/utility/native_integer.rb', line 8(2**(0.size * 8 - 2) - 1)
-
MIN_VALUE =
# File 'lib/concurrent-ruby/concurrent/utility/native_integer.rb', line 7
- 2))
Instance Method Summary
- #ensure_integer(value) Internal use only
- #ensure_integer_and_bounds(value) Internal use only
- #ensure_lower_bound(value) Internal use only
- #ensure_positive(value) Internal use only
- #ensure_positive_and_no_zero(value) Internal use only
- #ensure_upper_bound(value) Internal use only
Instance Method Details
#ensure_integer(value)
[ GitHub ]# File 'lib/concurrent-ruby/concurrent/utility/native_integer.rb', line 24
def ensure_integer(value) unless value.is_a?(Integer) raise ArgumentError.new("#{value} is not an Integer") end value end
#ensure_integer_and_bounds(value)
[ GitHub ]# File 'lib/concurrent-ruby/concurrent/utility/native_integer.rb', line 31
def ensure_integer_and_bounds(value) ensure_integer value ensure_upper_bound value ensure_lower_bound value end
#ensure_lower_bound(value)
[ GitHub ]#ensure_positive(value)
[ GitHub ]# File 'lib/concurrent-ruby/concurrent/utility/native_integer.rb', line 37
def ensure_positive(value) if value < 0 raise ArgumentError.new("#{value} cannot be negative") end value end
#ensure_positive_and_no_zero(value)
[ GitHub ]# File 'lib/concurrent-ruby/concurrent/utility/native_integer.rb', line 44
def ensure_positive_and_no_zero(value) if value < 1 raise ArgumentError.new("#{value} cannot be negative or zero") end value end