Class: Net::IMAP::PartialRange
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: |
Net::IMAP::CommandData
|
Defined in: | lib/net/imap/command_data.rb |
Constant Summary
-
NEG_RANGE =
# File 'lib/net/imap/command_data.rb', line 159-uint32_max..-1
-
Negative =
# File 'lib/net/imap/command_data.rb', line 161->{ (_1 in Range) and NEG_RANGE.cover?(_1) }
-
POS_RANGE =
# File 'lib/net/imap/command_data.rb', line 1581..uint32_max
-
Positive =
# File 'lib/net/imap/command_data.rb', line 160->{ (_1 in Range) and POS_RANGE.cover?(_1) }
Class Method Summary
- .new(data:) ⇒ PartialRange constructor
Instance Method Summary
Constructor Details
.new(data:) ⇒ PartialRange
# File 'lib/net/imap/command_data.rb', line 163
def initialize(data:) min, max = case data in Range data.minmax.map { Integer _1 } in ResponseParser::Patterns::PARTIAL_RANGE data.split(":").map { Integer _1 }.minmax else raise ArgumentError, "invalid partial range input: %p" % [data] end data = min..max unless data in Positive | Negative raise ArgumentError, "invalid partial-range: %p" % [data] end super rescue TypeError, RangeError raise ArgumentError, "expected range min/max to be Integers" end
Instance Method Details
#formatted
[ GitHub ]# File 'lib/net/imap/command_data.rb', line 181
def formatted = "%d:%d" % data.minmax
#send_data(imap, tag)
[ GitHub ]# File 'lib/net/imap/command_data.rb', line 183
def send_data(imap, tag) imap.__send__(:put_string, formatted) end