Sha256: cc1e451f1499db662df99c174c272e7a7b72c02f2f82cec72fb0c1d563e723f0

Contents?: true

Size: 336 Bytes

Versions: 1

Compression:

Stored size: 336 Bytes

Contents

# frozen_string_literal: false
require 'date'
OptionParser.accept(DateTime) do |s,|
  begin
    DateTime.parse(s) if s
  rescue ArgumentError
    raise OptionParser::InvalidArgument, s
  end
end
OptionParser.accept(Date) do |s,|
  begin
    Date.parse(s) if s
  rescue ArgumentError
    raise OptionParser::InvalidArgument, s
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cmd-optparse.rb-0.5.0 lib/cmd/option_parser/date.rb