Class: Net::IMAP::Atom

Inherits:
CommandData show all
Defined in:
lib/net/imap/command_data.rb

Overview

Please note that ATOM-CHAR and atom are not the same as ASTRING-char and the atom form of astring. astring allows ], but atom does not.

Generic string arguments in Net::IMAP use astring, so they will send as atoms even if they contain ].

This class is used by:

  • to validate generic symbol arguments, as the superclass of Flag
  • to validate #enable capabilities
  • to validate #store (and #uid_store) attr

Direct Known Subclasses

Flag

Instance Method Summary collapse

Methods inherited from CommandData

validate

Constructor Details

#initializeAtom

:nodoc:



302
303
304
305
# File 'lib/net/imap/command_data.rb', line 302

def initialize(**)
  super
  validate
end

Instance Method Details

#send_data(imap, tag) ⇒ Object



316
317
318
# File 'lib/net/imap/command_data.rb', line 316

def send_data(imap, tag)
  imap.__send__(:put_string, data.to_s)
end

#validateObject



307
308
309
310
311
312
313
314
# File 'lib/net/imap/command_data.rb', line 307

def validate
  data.to_s.ascii_only? \
    or raise DataFormatError, "#{self.class} must be ASCII only"
  data.match?(ResponseParser::Patterns::ATOM_SPECIALS) \
    and raise DataFormatError, "#{self.class} must not contain atom-specials"
  data.empty? \
    and raise DataFormatError, "#{self.class} must not be empty"
end