lib/net/imap/response_parser/parser_utils.rb in net-imap-0.4.12 vs lib/net/imap/response_parser/parser_utils.rb in net-imap-0.4.13

- old
+ new

@@ -152,11 +152,11 @@ token end end # To be used conditionally: - # assert_no_lookahead if Net::IMAP.debug + # assert_no_lookahead if config.debug? def assert_no_lookahead @token.nil? or parse_error("assertion failed: expected @token.nil?, actual %s: %p", @token.symbol, @token.value) end @@ -179,27 +179,27 @@ @token&.symbol, args.join(" or ")) end end def peek_str?(str) - assert_no_lookahead if Net::IMAP.debug + assert_no_lookahead if config.debug? @str[@pos, str.length] == str end def peek_re(re) - assert_no_lookahead if Net::IMAP.debug + assert_no_lookahead if config.debug? re.match(@str, @pos) end def accept_re(re) - assert_no_lookahead if Net::IMAP.debug + assert_no_lookahead if config.debug? re.match(@str, @pos) and @pos = $~.end(0) $~ end def match_re(re, name) - assert_no_lookahead if Net::IMAP.debug + assert_no_lookahead if config.debug? if re.match(@str, @pos) @pos = $~.end(0) $~ else parse_error("invalid #{name}") @@ -210,10 +210,10 @@ @token = nil end def parse_error(fmt, *args) msg = format(fmt, *args) - if IMAP.debug + if config.debug? local_path = File.dirname(__dir__) tok = @token ? "%s: %p" % [@token.symbol, @token.value] : "nil" warn "%s %s: %s" % [self.class, __method__, msg] warn " tokenized : %s" % [@str[...@pos].dump] warn " remaining : %s" % [@str[@pos..].dump]