Class: Net::IMAP::ResponseParser
- Inherits:
-
Object
- Object
- Net::IMAP::ResponseParser
- Extended by:
- ParserUtils::Generator
- Includes:
- ParserUtils, ResponseConditions
- Defined in:
- lib/net/imap/response_parser.rb,
lib/net/imap/response_parser/parser_utils.rb
Overview
Parses an IMAP server response.
Defined Under Namespace
Modules: ParserUtils, Patterns, ResponseConditions Classes: Token
Constant Summary
Constants included from ParserUtils::Generator
ParserUtils::Generator::LOOKAHEAD, ParserUtils::Generator::SHIFT_TOKEN
Constants included from ResponseConditions
ResponseConditions::AUTH_CONDS, ResponseConditions::BAD, ResponseConditions::BYE, ResponseConditions::GREETING_CONDS, ResponseConditions::NO, ResponseConditions::OK, ResponseConditions::PREAUTH, ResponseConditions::RESP_CONDS, ResponseConditions::RESP_COND_STATES, ResponseConditions::RESP_DATA_CONDS
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config: Config.global) ⇒ ResponseParser
constructor
:call-seq: Net::IMAP::ResponseParser.new -> Net::IMAP::ResponseParser.
-
#parse(str) ⇒ Object
:call-seq: parse(str) -> ContinuationRequest parse(str) -> UntaggedResponse parse(str) -> TaggedResponse.
Methods included from ParserUtils::Generator
def_char_matchers, def_token_matchers
Constructor Details
#initialize(config: Config.global) ⇒ ResponseParser
:call-seq: Net::IMAP::ResponseParser.new -> Net::IMAP::ResponseParser
17 18 19 20 21 22 23 |
# File 'lib/net/imap/response_parser.rb', line 17 def initialize(config: Config.global) @str = nil @pos = nil @lex_state = nil @token = nil @config = Config[config] end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
14 15 16 |
# File 'lib/net/imap/response_parser.rb', line 14 def config @config end |
Instance Method Details
#parse(str) ⇒ Object
:call-seq:
parse(str) -> ContinuationRequest
parse(str) -> UntaggedResponse
parse(str) -> TaggedResponse
Raises ResponseParseError for unparsable strings.
31 32 33 34 35 36 37 |
# File 'lib/net/imap/response_parser.rb', line 31 def parse(str) @str = str @pos = 0 @lex_state = EXPR_BEG @token = nil return response end |