123456789_123456789_123456789_123456789_123456789_

Class: Net::IMAP::CommandData

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

Overview

simplistic emulation of CommandData = Data.define(:data)

Class Method Summary

Instance Attribute Summary

  • #data (also: #formatted) readonly

Instance Method Summary

Constructor Details

.new(arg = nil, data: arg) ⇒ CommandData Also known as: .[]

[ GitHub ]

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

def new(arg = nil, data: arg) super(data: data) end

#initialize(data:) ⇒ CommandData

[ GitHub ]

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

def initialize(data:)
  @data = data
  freeze
end

Class Method Details

.[](arg = nil, data: arg)

Alias for .new.

[ GitHub ]

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

alias :[] :new

.validate

following class definition goes beyond the basic Data.define(:data)

[ GitHub ]

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

def self.validate(...)
  data = new(...)
  data.validate
  data
end

Instance Attribute Details

#data (readonly) Also known as: #formatted

[ GitHub ]

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

attr_reader :data

Instance Method Details

#==(other)

[ GitHub ]

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

def ==(other)   self.class === other && to_h  ==  other.to_h  end

#eql?(other) ⇒ Boolean

[ GitHub ]

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

def eql?(other) self.class === other && to_h.eql?(other.to_h) end

#send_data(imap, tag)

Raises:

  • (NoMethodError)
[ GitHub ]

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

def send_data(imap, tag)
  raise NoMethodError, "#{self.class} must implement #{__method__}"
end

#to_h(&block)

[ GitHub ]

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

def to_h(&block) block ? to_h.to_h(&block) : { data: data } end

#validate

[ GitHub ]

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

def validate
end