def parse(tweets)
      retdict = {
        mentions: {},
        hashtags: {},
        clients: {},
        smileys: {},
        times_of_day: [0] * 24,
        tweet_count: 0,
        retweet_count: 0,
        selftweet_count: 0,
      }
      tweets.each do |tweet|
        parsed_tweet = self.parse_one tweet

        if parsed_tweet[:retweet]  # the tweet was a retweet
          # increase retweeted tweets count
          retdict[:retweet_count] += 1
        else
          parsed_tweet[:mentions].each do |user, data|  # add mentions to the mentions dict
            retdict[:mentions][user] ||= { count: 0 }
            retdict[:mentions][user][:count] += data[:count]
            retdict[:mentions][user][:name] ||= data[:name]
            retdict[:mentions][user][:examples] ||= []
            retdict[:mentions][user][:examples] << data[:example]
          end
          parsed_tweet[:hashtags].each do |hashtag, data|  # add hashtags to the hashtags dict
            retdict[:hashtags][hashtag] ||= { count: 0 }
            retdict[:hashtags][hashtag][:count] += data[:count]
            retdict[:hashtags][hashtag][:hashtag] ||= data[:hashtag]
            retdict[:hashtags][hashtag][:examples] ||= []
            retdict[:hashtags][hashtag][:examples] << data[:example]
          end

          parsed_tweet[:smileys].each do |smile, data|
            retdict[:smileys][smile] ||= { count: 0 }
            retdict[:smileys][smile][:frown] ||= data[:frown]
            retdict[:smileys][smile][:count] += data[:count]
            retdict[:smileys][smile][:smiley] ||= data[:smiley]
            retdict[:smileys][smile][:examples] ||= []
            retdict[:smileys][smile][:examples] << data[:example]
          end

          # increase self tweeted tweets count
          retdict[:selftweet_count] += 1
        end

        # add client to the clients dict
        client_dict = parsed_tweet[:client][:name]
        retdict[:clients][client_dict] ||= { count: 0 }
        retdict[:clients][client_dict][:count] += 1
        retdict[:clients][client_dict][:name] = parsed_tweet[:client][:name]
        retdict[:clients][client_dict][:url] = parsed_tweet[:client][:url]

        retdict[:times_of_day][parsed_tweet[:time_of_day]] += 1

        # increase tweet count
        retdict[:tweet_count] += 1
      end

      retdict
    end
def parse(tweets)
      retdict = {
        mentions: {},
        hashtags: {},
        clients: {},
        smileys: {},
        times_of_day: [0] * 24,
        tweet_count: 0,
        retweet_count: 0,
        selftweet_count: 0,
      }
      tweets.each do |tweet|
        parsed_tweet = self.parse_one tweet

        if parsed_tweet[:retweet]  # the tweet was a retweet
          # increase retweeted tweets count
          retdict[:retweet_count] += 1
        else
          parsed_tweet[:mentions].each do |user, data|  # add mentions to the mentions dict
            retdict[:mentions][user] ||= { count: 0 }
            retdict[:mentions][user][:count] += data[:count]
            retdict[:mentions][user][:name] ||= data[:name]
            retdict[:mentions][user][:examples] ||= []
            retdict[:mentions][user][:examples] << data[:example]
          end
          parsed_tweet[:hashtags].each do |hashtag, data|  # add hashtags to the hashtags dict
            retdict[:hashtags][hashtag] ||= { count: 0 }
            retdict[:hashtags][hashtag][:count] += data[:count]
            retdict[:hashtags][hashtag][:hashtag] ||= data[:hashtag]
            retdict[:hashtags][hashtag][:examples] ||= []
            retdict[:hashtags][hashtag][:examples] << data[:example]
          end

          parsed_tweet[:smileys].each do |smile, data|
            retdict[:smileys][smile] ||= { count: 0 }
            retdict[:smileys][smile][:frown] ||= data[:frown]
            retdict[:smileys][smile][:count] += data[:count]
            retdict[:smileys][smile][:smiley] ||= data[:smiley]
            retdict[:smileys][smile][:examples] ||= []
            retdict[:smileys][smile][:examples] << data[:example]
          end

          # increase self tweeted tweets count
          retdict[:selftweet_count] += 1
        end

        # add client to the clients dict
        client_dict = parsed_tweet[:client][:name]
        retdict[:clients][client_dict] ||= { count: 0 }
        retdict[:clients][client_dict][:count] += 1
        retdict[:clients][client_dict][:name] = parsed_tweet[:client][:name]
        retdict[:clients][client_dict][:url] = parsed_tweet[:client][:url]

        retdict[:times_of_day][parsed_tweet[:time_of_day]] += 1

        # increase tweet count
        retdict[:tweet_count] += 1
      end

      retdict
    end
Parses an array of tweets

 Returns a dict of things