<commit_before>module Consent
  module Extensions
    module Integer
      
      %w(second minute hour day month).each do |interval|
        module_eval do
          define_method("per_#{ interval }") do
            Rate.new(self, 1.__send__(interval))
          end
        end
      end
      
    end
  end
  
  class Rate
    attr_reader :limit, :interval
    
    def initialize(limit, interval)
      @limit, @interval = limit, interval
    end
  end
end
<commit_msg>Adding Extensions::Integer#per, allowing expressions like '2000.per 15.minutes'.<commit_after>module Consent
  module Extensions
    module Integer
      
      %w(second minute hour day month).each do |interval|
        module_eval do
          define_method("per_#{ interval }") do
            Rate.new(self, 1.__send__(interval))
          end
        end
      end
      
      def per(interval)
        Rate.new(self, interval)
      end
      
    end
  end
  
  class Rate
    attr_reader :limit, :interval
    
    def initialize(limit, interval)
      @limit, @interval = limit, interval
    end
  end
end

{'fraction_non_alphanumeric': 0.07621671258034894, 'fraction_numerical': 0.0073461891643709825, 'mean_word_length': 1.9863013698630136, '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': '1862752', 'n_tokens_mistral': 320, 'n_tokens_neox': 312, 'n_words': 91}