diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date_time/acts_like.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/date_time/acts_like.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/date_time/acts_like.rb b/activesupport/lib/active_support/core_ext/date_time/acts_like.rb new file mode 100644 index 0000000000..5dccdfe219 --- /dev/null +++ b/activesupport/lib/active_support/core_ext/date_time/acts_like.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require "date" +require "active_support/core_ext/object/acts_like" + +class DateTime + # Duck-types as a Date-like class. See Object#acts_like?. + def acts_like_date? + true + end + + # Duck-types as a Time-like class. See Object#acts_like?. + def acts_like_time? + true + end +end |