lib/code/object/date.rb in code-ruby-0.12.0 vs lib/code/object/date.rb in code-ruby-0.13.0

- old
+ new

@@ -4,19 +4,14 @@ class Object class Date < Object def initialize(*args, **_kargs, &_block) raw = args.map(&:to_s).join("-").presence || ::Date.current.to_s @raw = ::Date.parse(raw) - super rescue ::Date::Error raise Error, "#{raw.inspect} is an invalid date" end - def self.name - "Date" - end - def self.call(**args) operator = args.fetch(:operator, nil) case operator.to_s when "tomorrow" @@ -52,21 +47,9 @@ end def self.code_yesterday ::Time.zone ||= Time::DEFAULT_ZONE new(::Time.zone.yesterday.beginning_of_day) - end - - def inspect - to_s - end - - def to_s - raw.to_s - end - - def as_json(...) - raw.as_json(...) end end end end