1 require 'optparse' 2 require 'time' 3 4 OptionParser.accept(Time) do |s| 5 begin 6 (Time.httpdate(s) rescue Time.parse(s)) if s 7 rescue 8 raise OptionParser::InvalidArgument, s 9 end 10 end