module MiniCheck
  class ChecksCollection < Array
    def to_hash
      resp = {}
      each.map do |check|
        resp[check.name] = check.to_hash
      end

      resp
    end

    def healthy?
      all?(&:healthy?)
    end

    def run
      each{|c| c.run }
    end

    def register name, &block
      self.<< Check.new(name, &block)
    end
  end
end

module MiniCheck
  class ChecksCollection < Array
    def to_hash
      Hash[map { |check| [check.name, check.to_hash] }]
    end

    def healthy?
      all?(&:healthy?)
    end

    def run
      each{|c| c.run }
    end

    def register name, &block
      self.<< Check.new(name, &block)
    end
  end
end

Use functional style to convert the array into hash
Use functional style to convert the array into hash
