123456789_123456789_123456789_123456789_123456789_

Class: Net::IMAP::PartialRange

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Net::IMAP::CommandData
  • Object
Defined in: lib/net/imap/command_data.rb

Constant Summary

Class Method Summary

Instance Method Summary

Constructor Details

.new(data:) ⇒ PartialRange

[ GitHub ]

  
# 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