class Optimist::DateOption
Option
for dates. Uses Chronic if it exists.
Public Instance Methods
parse(paramlist, _neg_given)
click to toggle source
# File lib/optimist.rb, line 829 def parse(paramlist, _neg_given) paramlist.map do |pg| pg.map do |param| next param if param.is_a?(Date) begin begin require 'chronic' time = Chronic.parse(param) rescue LoadError # chronic is not available end time ? Date.new(time.year, time.month, time.day) : Date.parse(param) rescue ArgumentError raise CommandlineError, "option '#{self.name}' needs a date" end end end end
type_format()
click to toggle source
# File lib/optimist.rb, line 828 def type_format ; "=<date>" ; end