<commit_before>module Philotic
  class Subscriber
    class Metadata
      attr_accessor :attributes

      def initialize(attributes)
        self.attributes = attributes
      end
    end

    def self.subscribe(options = {}, subscribe_options = Philotic::DEFAULT_SUBSCRIBE_OPTIONS)
      if block_given?
        if Philotic.connected?
          _subscribe(options, subscribe_options, &Proc.new)
        else
          Philotic.connect! do
            _subscribe(options, subscribe_options, &Proc.new)
          end
        end
      else
        if Philotic.connected?
          _subscribe(options, subscribe_options)
        else
          Philotic.connect! do
            _subscribe(options, subscribe_options)
          end
        end
      end

    end

    def self.subscribe_to_any_or_all_of(any_or_all, options = {})
      arguments     = options[:arguments] || {}
      queue_options = options[:queue_options] || {}

      arguments['x-match'] = any_or_all<commit_msg>add ability to ack and reject messages<commit_after>module Philotic
  class Subscriber
    class Metadata
      attr_accessor :attributes

      def initialize(attributes)
        self.attributes = attributes
      end
    end

    def self.subscribe(options = {}, subscribe_options = Philotic::DEFAULT_SUBSCRIBE_OPTIONS)
      if block_given?
        if Philotic.connected?
          _subscribe(options, subscribe_options, &Proc.new)
        else
          Philotic.connect! do
            _subscribe(options, subscribe_options, &Proc.new)
          end
        end
      else
        if Philotic.connected?
          _subscribe(options, subscribe_options)
        else
          Philotic.connect! do
            _subscribe(options, subscribe_options)
          end
        end
      end
    end

    def self.acknowledge(message, up_to_and_including=false)
      Philotic::Connection.channel.acknowledge(message[:delivery_info].delivery_tag, up_to_and_including)
    end

    def self.reject(message, requeue=true)
      Philotic::Connection.channel.reject(message[:delivery_info].delivery_tag, requeue)
    end

    def self.subscribe_to_any_or_all_of(any_or_all, options = {})
      arguments     = options[:arguments] || {}
      queue_options = options[:queue_options] || {}

      arguments['x-match'] = any_or_all
{'fraction_non_alphanumeric': 0.07822685788787484, 'fraction_numerical': 0.0, 'mean_word_length': 2.4773413897280965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3070895', 'n_tokens_mistral': 655, 'n_tokens_neox': 633, 'n_words': 129}