<commit_before>module Houston
  APPLE_PRODUCTION_GATEWAY_URI = "apn://gateway.push.apple.com:2195"
  APPLE_PRODUCTION_FEEDBACK_URI = "apn://feedback.push.apple.com:2196"

  APPLE_DEVELOPMENT_GATEWAY_URI = "apn://gateway.sandbox.push.apple.com:2195"
  APPLE_DEVELOPMENT_FEEDBACK_URI = "apn://feedback.sandbox.push.apple.com:2196"

  class Client
    attr_accessor :gateway_uri, :feedback_uri, :certificate, :passphrase

    def initialize
      @gateway_uri = ENV['APN_GATEWAY_URI']
      @feedback_uri = ENV['APN_FEEDBACK_URI']
      @certificate = ENV['APN_CERTIFICATE']
      @passphrase = ENV['<PASSWORD>']
    end

    def self.development
      client = self.new
      client.gateway_uri = APPLE_DEVELOPMENT_GATEWAY_URI
      client.feedback_uri = APPLE_DEVELOPMENT_FEEDBACK_URI
      client
    end

    def self.production
      client = self.new
      client.gateway_uri = APPLE_PRODUCTION_GATEWAY_URI
      client.feedback_uri = APPLE_PRODUCTION_FEEDBACK_URI
      client
    end

    def push(*notifications)
      return if notifications.empty?

      Connection.open(@gateway_uri, @certificate, @passphrase) do |connection|
        notifications.flatten.each do |notification|
          next unless notification.kind_of?(Notification)
          next if notification.sent?

          connection.write(notification.message)
          notification.mark_as_sent!
        end
      end
    end

    def devices
      devices = []

      Connection.open(@feedback_uri, @certificate, @passphrase) do |connection|
        while line = connection.read(38)
          feedback = line.unpack('N1n1H140')
          token = feedback[2].scan(/.{0,8}/).join(' ').strip
          devices << token if token
        end
      end

      devices
    end<commit_msg>Using eigenclass for class methods<commit_after>module Houston
  APPLE_PRODUCTION_GATEWAY_URI = "apn://gateway.push.apple.com:2195"
  APPLE_PRODUCTION_FEEDBACK_URI = "apn://feedback.push.apple.com:2196"

  APPLE_DEVELOPMENT_GATEWAY_URI = "apn://gateway.sandbox.push.apple.com:2195"
  APPLE_DEVELOPMENT_FEEDBACK_URI = "apn://feedback.sandbox.push.apple.com:2196"

  class Client
    attr_accessor :gateway_uri, :feedback_uri, :certificate, :passphrase

    class << self
      def development
        client = self.new
        client.gateway_uri = APPLE_DEVELOPMENT_GATEWAY_URI
        client.feedback_uri = APPLE_DEVELOPMENT_FEEDBACK_URI
        client
      end

      def production
        client = self.new
        client.gateway_uri = APPLE_PRODUCTION_GATEWAY_URI
        client.feedback_uri = APPLE_PRODUCTION_FEEDBACK_URI
        client
      end
    end

    def initialize
      @gateway_uri = ENV['APN_GATEWAY_URI']
      @feedback_uri = ENV['APN_FEEDBACK_URI']
      @certificate = ENV['APN_CERTIFICATE']
      @passphrase = ENV['<PASSWORD>']
    end

    def push(*notifications)
      return if notifications.empty?

      Connection.open(@gateway_uri, @certificate, @passphrase) do |connection|
        notifications.flatten.each do |notification|
          next unless notification.kind_of?(Notification)
          next if notification.sent?

          connection.write(notification.message)
          notification.mark_as_sent!
        end
      end
    end

    def devices
      devices = []

      Connection.open(@feedback_uri, @certificate, @passphrase) do |connection|
        while line = connection.read(38)
          feedback = line.unpack('N1n1H140')
          token = feedback[2].scan(/.{0,8}/).join(' ').strip
          devices << token if token
        end
      end

      devices
    end
{'fraction_non_alphanumeric': 0.09286713286713287, 'fraction_numerical': 0.014545454545454545, 'mean_word_length': 2.8576051779935274, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2058959', 'n_tokens_mistral': 1237, 'n_tokens_neox': 1147, 'n_words': 198}