Class: Remailer::IMAP::Client::Interpreter

Inherits:
Remailer::Interpreter show all
Defined in:
lib/remailer/imap/client/interpreter.rb

Constant Summary collapse

LINE_REGEXP =

Constants ============================================================

/^(.*?)\r?\n/.freeze
RESPONSE_REGEXP =
/^(\S+)(?:\s+(?:(OK|NO|BAD)\s+)?([^\r\n]*))?\r?\n/.freeze

Instance Attribute Summary

Attributes inherited from Remailer::Interpreter

#delegate, #error, #state

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Remailer::Interpreter

config, create_parser_for_spec, default, default_interpreter, default_parser, #enter_state, #error?, #finished?, initial_state, initial_state=, #initialize, #interpret, on_error, on_error_handler, parse, #parse, #parser, #process, state, state_defined?, states, states_default, states_defined, states_empty?, #will_interpret?

Constructor Details

This class inherits a constructor from Remailer::Interpreter

Class Method Details

.split_list_definition(string) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/remailer/imap/client/interpreter.rb', line 20

def self.split_list_definition(string)
  m = string.match(/^\(([^\)]+)\)\s+\"((?:\\\"|\\x[0-9a-fA-F][0-9a-fA-F]|\\[abtnvfr]|.)+)\"\s+\"((?:\\\"|\\x[0-9a-fA-F][0-9a-fA-F]|\\[abtnvfr]|.)+)\"/)
  
  return unless (m)
  
  split = m.to_a
  split.shift
  split[0] = split[0].split(/\s+/)
  
  split
end

.split_reply(reply) ⇒ Object

Class Methods ========================================================



9
10
11
12
13
14
15
16
17
18
# File 'lib/remailer/imap/client/interpreter.rb', line 9

def self.split_reply(reply)
  if (m = reply.match(RESPONSE_REGEXP))
    parts = m.to_a
    parts.shift
    
    parts
  else
    nil
  end
end

Instance Method Details

#labelObject

Instance Methods =====================================================



98
99
100
# File 'lib/remailer/imap/client/interpreter.rb', line 98

def label
  'IMAP'
end