Sha256: 86becb025a13963f47ac3a2e4941de1509e49071161f0396f178a44b87b63bd6

Contents?: true

Size: 357 Bytes

Versions: 12

Compression:

Stored size: 357 Bytes

Contents

module IntercomRails
  class DateHelper
    def self.convert_dates_to_unix_timestamps(object)
      return Hash[object.map { |k, v| [k, convert_dates_to_unix_timestamps(v)] }] if object.is_a?(Hash)
      return object.to_i if object.is_a?(Time) || object.is_a?(DateTime)
      return object.to_time.to_i if object.is_a?(Date)
      object
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
intercom-rails-1.0.6 lib/intercom-rails/date_helper.rb
intercom-rails-1.0.5 lib/intercom-rails/date_helper.rb
intercom-rails-1.0.4 lib/intercom-rails/date_helper.rb
intercom-rails-1.0.1 lib/intercom-rails/date_helper.rb
intercom-rails-1.0.0 lib/intercom-rails/date_helper.rb
intercom-rails-0.4.2 lib/intercom-rails/date_helper.rb
intercom-rails-0.4.1 lib/intercom-rails/date_helper.rb
intercom-rails-0.4.0 lib/intercom-rails/date_helper.rb
intercom-rails-0.3.8 lib/intercom-rails/date_helper.rb
intercom-rails-0.3.5 lib/intercom-rails/date_helper.rb
intercom-rails-0.3.4 lib/intercom-rails/date_helper.rb
intercom-rails-0.3.3 lib/intercom-rails/date_helper.rb