Class: Net::IMAP::Literal
- Inherits:
-
Object
- Object
- Net::IMAP::Literal
- Defined in:
- lib/net/imap/command_data.rb
Overview
:nodoc:
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #bytesize ⇒ Object
-
#initialize(data:, non_sync: nil) ⇒ Literal
constructor
A new instance of Literal.
- #send_data(imap, tag) ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize(data:, non_sync: nil) ⇒ Literal
Returns a new instance of Literal.
316 317 318 319 320 321 |
# File 'lib/net/imap/command_data.rb', line 316 def initialize(data:, non_sync: nil) data = -String(data.to_str).b or raise DataFormatError, "#{self.class} expects string input" super validate end |
Class Method Details
.validate ⇒ Object
310 311 312 313 314 |
# File 'lib/net/imap/command_data.rb', line 310 def self.validate(...) data = new(...) data.validate data end |
Instance Method Details
#bytesize ⇒ Object
323 |
# File 'lib/net/imap/command_data.rb', line 323 def bytesize = data.bytesize |
#send_data(imap, tag) ⇒ Object
332 333 334 |
# File 'lib/net/imap/command_data.rb', line 332 def send_data(imap, tag) imap.__send__(:send_literal, data, tag, non_sync:) end |
#validate ⇒ Object
325 326 327 328 329 330 |
# File 'lib/net/imap/command_data.rb', line 325 def validate if data.include?("\0") raise DataFormatError, "NULL byte not allowed in #{self.class}. " \ "Use #{Literal8} or a null-safe encoding." end end |