From 11350e83d965fd5d9d62324016434c4e5f1123d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20G=C3=B3mez?= Date: Wed, 11 Apr 2018 10:50:45 -0300 Subject: [PATCH] fix: rails 4.0.x Patch time_atts when `compact` is not defined in Hash class. --- lib/crono/period.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/crono/period.rb b/lib/crono/period.rb index 802145e..ffa9b62 100644 --- a/lib/crono/period.rb +++ b/lib/crono/period.rb @@ -78,7 +78,8 @@ module Crono end def time_atts - { hour: @at_hour, min: @at_min }.compact + atts = { hour: @at_hour, min: @at_min } + atts.respond_to?(:compact) ? atts.compact : atts.select { |_, value| !value.nil? } end end end