Sha256: d3284a26b0f6d91f3cca6ff45dd440d0da9ce52e5453d56ee3b5c46f2433e0a5

Contents?: true

Size: 356 Bytes

Versions: 1

Compression:

Stored size: 356 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

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