Module
Common validators of number and nz_number types
Class Methods
lib/net/imap.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/net/imap.rb, line 1705
def ensure_mod_sequence_value(num)
return if valid_mod_sequence_value?(num)
msg = "mod_sequence_value must be unsigned 64-bit integer: #{num}"
raise DataFormatError, msg
end
Ensure argument is ‘mod_sequence_value’ or raise DataFormatError
lib/net/imap.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/net/imap.rb, line 1689
def ensure_number(num)
return if valid_number?(num)
msg = "number must be unsigned 32-bit integer: #{num}"
raise DataFormatError, msg
end
Ensure argument is ‘number’ or raise DataFormatError
lib/net/imap.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/net/imap.rb, line 1697
def ensure_nz_number(num)
return if valid_nz_number?(num)
msg = "nz_number must be non-zero unsigned 32-bit integer: #{num}"
raise DataFormatError, msg
end
Ensure argument is ‘nz_number’ or raise DataFormatError
lib/net/imap.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/net/imap.rb, line 1680
def valid_mod_sequence_value?(num)
# mod-sequence-value = 1*DIGIT
# ; Positive unsigned 64-bit integer
# ; (mod-sequence)
# ; (1 <= n < 18,446,744,073,709,551,615)
num >= 1 && num < 18446744073709551615
end
Check is passed argument valid ‘mod_sequence_value’ in RFC 4551 terminology
lib/net/imap.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/net/imap.rb, line 1662
def valid_number?(num)
# [RFC 3501]
# number = 1*DIGIT
# ; Unsigned 32-bit integer
# ; (0 <= n < 4,294,967,296)
num >= 0 && num < 4294967296
end
Check is passed argument valid ‘number’ in RFC 3501 terminology
lib/net/imap.rb
View on GitHub
# File tmp/rubies/ruby-2.6.10/lib/net/imap.rb, line 1671
def valid_nz_number?(num)
# [RFC 3501]
# nz-number = digit-nz *DIGIT
# ; Non-zero unsigned 32-bit integer
# ; (0 < n < 4,294,967,296)
num != 0 && valid_number?(num)
end
Check is passed argument valid ‘nz_number’ in RFC 3501 terminology