123456789_123456789_123456789_123456789_123456789_

Class: Net::IMAP::MessageSet

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) ⇒ MessageSet (private)

[ GitHub ]

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

def initialize(data)
  @data = data
end

Instance Method Details

#format_internal(data) (private)

[ GitHub ]

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

def format_internal(data)
  case data
  when "*"
    return data
  when Integer
    if data == -1
      return "*"
    else
      return data.to_s
    end
  when Range
    return format_internal(data.first) +
      ":" + format_internal(data.last)
  when Array
    return data.collect {|i| format_internal(i)}.join(",")
  when ThreadMember
    return data.seqno.to_s +
      ":" + data.children.collect {|i| format_internal(i).join(",")}
  end
end

#send_data(imap, tag)

[ GitHub ]

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

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

#validate

[ GitHub ]

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

def validate
  validate_internal(@data)
end

#validate_internal(data) (private)

[ GitHub ]

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

def validate_internal(data)
  case data
  when "*"
  when Integer
    NumValidator.ensure_nz_number(data)
  when Range
  when Array
    data.each do |i|
      validate_internal(i)
    end
  when ThreadMember
    data.children.each do |i|
      validate_internal(i)
    end
  else
    raise DataFormatError, data.inspect
  end
end