<commit_before>require 'rubygems'
require 'fattr'
require File.join(File.dirname(__FILE__),'mongo_scope','util')

module MongoScope
  module ScopeMethods
    def scope(ops)
      ScopedCollection.new(ops,self)
    end
    def scope_eq(ops)
      scope_ops = {:field => ops.keys.first, :val => ops.values.first}
      ScopedCollection.new(EqScope.new(scope_ops),self)
    end
    %w(in gt nin).each do |op|
      define_method("scope_#{op}") do |ops|
        scope(:op => "$#{op}", :field => ops.keys.first, :val => ops.values.first)
      end
    end
  end

  module CollMethods
    def count
      find.count
    end
  end

  class ScopedCollection
    include ScopeMethods
    include CollMethods
    attr_accessor :scope_obj, :coll
    def initialize(scope_ops,coll)
      self.scope_obj = Scope.new(scope_ops)<commit_msg>no fattr, add lt op<commit_after>require 'rubygems'
require File.join(File.dirname(__FILE__),'mongo_scope','util')

module MongoScope
  module ScopeMethods
    def scope(ops)
      ScopedCollection.new(ops,self)
    end
    def scope_eq(ops)
      scope_ops = {:field => ops.keys.first, :val => ops.values.first}
      ScopedCollection.new(EqScope.new(scope_ops),self)
    end
    %w(in gt lt nin).each do |op|
      define_method("scope_#{op}") do |ops|
        scope(:op => "$#{op}", :field => ops.keys.first, :val => ops.values.first)
      end
    end
  end

  module CollMethods
    def count
      find.count
    end
  end

  class ScopedCollection
    include ScopeMethods
    include CollMethods
    attr_accessor :scope_obj, :coll
    def initialize(scope_ops,coll)
      self.scope_obj = Scope.new(scope_ops)
{'fraction_non_alphanumeric': 0.11868533171028606, 'fraction_numerical': 0.0, 'mean_word_length': 3.193877551020408, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '6467009', 'n_tokens_mistral': 560, 'n_tokens_neox': 556, 'n_words': 122}