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
Creates a new 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
Creates a new ResponseParser.
When config is frozen or global, the parser #config inherits from it. Otherwise, config will be used directly.
20 21 22 23 24 25 26 27 |
# File 'lib/net/imap/response_parser.rb', line 20 def initialize(config: Config.global) @str = nil @pos = nil @lex_state = nil @token = nil @config = Config[config] @config = @config.new if @config == Config.global || @config.frozen? 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.
35 36 37 38 39 40 41 |
# File 'lib/net/imap/response_parser.rb', line 35 def parse(str) @str = str @pos = 0 @lex_state = EXPR_BEG @token = nil return response end |