class Embulk::Guess::TimeFormatGuess::Rfc2822Pattern
def initialize
def initialize @regexp = /^(?<weekday>#{WEEKDAY_NAME_SHORT}, )?\d\d #{MONTH_NAME_SHORT} \d\d\d\d(?<time> \d\d:\d\d(?<second>:\d\d)? (?:(?<zone_off>#{ZONE_OFF})|(?<zone_abb>#{ZONE_ABB})))?$/ end
def match(text)
def match(text) if m = @regexp.match(text) format = '' format << "%a, " if m['weekday'] format << "%d %b %Y" format << " %H:%M" if m['time'] format << ":%S" if m['second'] if m['zone_off'] if m['zone_off'].include?(':') format << " %:z" else format << " %z" end elsif m['zone_abb'] # don't use %Z: https://github.com/jruby/jruby/issues/3702 format << " %z" if m['zone_abb'] end SimpleMatch.new(format) else nil end end