sshaw/rack-downtime

View on GitHub
lib/rack/downtime/utils.rb

Summary

Maintainability
A
0 mins
Test Coverage
require "date"

class Rack::Downtime
  module Utils
    def parse_downtime(data)
      return unless data

      downtime = data.split("/", 2).map { |date| DateTime.iso8601(date) }
      downtime.empty? ? nil : downtime
    end

    module_function :parse_downtime
  end
end