123456789_123456789_123456789_123456789_123456789_

Class: Net::IMAP::ClientID

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

Class Method Summary

Instance Method Summary

Constructor Details

.new(data) ⇒ ClientID (private)

[ GitHub ]

  
# File 'lib/net/imap/command_data.rb', line 243

def initialize(data)
  @data = data
end

Instance Method Details

#format_internal(client_id) (private)

[ GitHub ]

  
# File 'lib/net/imap/command_data.rb', line 257

def format_internal(client_id)
  return nil if client_id.nil?
  client_id.to_h.flat_map {|k,v|
    [StringFormatter.string(k), StringFormatter.nstring(v)]
  }
end

#send_data(imap, tag)

[ GitHub ]

  
# File 'lib/net/imap/command_data.rb', line 233

def send_data(imap, tag)
  imap.__send__(:send_data, format_internal(@data), tag)
end

#validate

[ GitHub ]

  
# File 'lib/net/imap/command_data.rb', line 237

def validate
  validate_internal(@data)
end

#validate_internal(client_id) (private)

[ GitHub ]

  
# File 'lib/net/imap/command_data.rb', line 247

def validate_internal(client_id)
  client_id.to_h.each do |k,v|
    unless StringFormatter.valid_string?(k)
      raise DataFormatError, client_id.inspect
    end
  end
rescue NoMethodError, TypeError # to_h failed
  raise DataFormatError, client_id.inspect
end