lib/my_age/cli.rb in my_age-0.1.0 vs lib/my_age/cli.rb in my_age-0.1.1

- old
+ new

@@ -6,13 +6,13 @@ attr_accessor :dob include MyAge::Calculator desc "is AGE", "-d date_of_birth -a as_of_date, Dates are in yyyy-mm-dd format" method_option :dob, aliases: "d", desc: "date of birth in yyyy-mm-dd", required: true - method_option :as_of, aliases: "a", desc: "as of date in yyyy-mm-dd", required: true + method_option :as_of, aliases: "a", desc: "as of date in yyyy-mm-dd", required: false def is self.dob = DateTime.strptime(options[:dob], "%Y-%m-%d") - date = DateTime.strptime(options[:as_of], "%Y-%m-%d") + date = options[:as_of].present? ? DateTime.strptime(options[:as_of], "%Y-%m-%d") : Date.today puts self.age(date) end end end