Class: OptimistXL::DateOption
Overview
Option for dates. No longer uses Chronic if available. If chronic style dates are needed, then you may require ‘optimist_xl/chronic’
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Option
#default, #long, #max_args, #min_args, #multi_given, #name, #permitted, #permitted_response, #short
Instance Method Summary collapse
Methods inherited from Option
#array_default?, #callback, #compatible_with?, create, #desc, #description_with_default, #description_with_permitted, #doesnt_need_autogen_short, #educate, #format_stdio, #full_description, handle_long_opt, handle_short_opt, #initialize, #multi, #opts, #opts=, #permitted_type_valid?, #permitted_valid_string, #permitted_value?, register_alias, #required?, #validate_permitted
Constructor Details
This class inherits a constructor from OptimistXL::Option
Instance Method Details
#parse(paramlist, _neg_given) ⇒ Object
1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 |
# File 'lib/optimist_xl.rb', line 1246 def parse(paramlist, _neg_given) paramlist.map do |pg| pg.map do |param| next param if param.is_a?(Date) begin Date.parse(param) rescue ArgumentError raise CommandlineError, "option '#{self.name}' needs a date" end end end end |
#type_format ⇒ Object
1245 |
# File 'lib/optimist_xl.rb', line 1245 def type_format ; "=<date>" ; end |