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.
343 344 345 346 347 348 |
# File 'lib/net/imap/command_data.rb', line 343 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
337 338 339 340 341 |
# File 'lib/net/imap/command_data.rb', line 337 def self.validate(...) data = new(...) data.validate data end |
Instance Method Details
#bytesize ⇒ Object
350 |
# File 'lib/net/imap/command_data.rb', line 350 def bytesize = data.bytesize |
#send_data(imap, tag) ⇒ Object
359 360 361 |
# File 'lib/net/imap/command_data.rb', line 359 def send_data(imap, tag) imap.__send__(:send_literal, data, tag, non_sync:) end |
#validate ⇒ Object
352 353 354 355 356 357 |
# File 'lib/net/imap/command_data.rb', line 352 def validate if data.include?("\0") raise DataFormatError, "NULL byte not allowed in #{self.class}. " \ "Use #{Literal8} or a null-safe encoding." end end |