Sha256: d499e0bf548bc843580f145f84a9f20c3d8abb74d8c65543119101e446cf4125

Contents?: true

Size: 356 Bytes

Versions: 3

Compression:

Stored size: 356 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cli-option_parser.rb-0.6.0 lib/cli/option_parser/date.rb
cli-option_parser.rb-0.5.3 lib/cli/option_parser/date.rb
cli-option_parser.rb-0.5.2 lib/cli/option_parser/date.rb