<commit_before>require 'json'

class Chef
  class Mongodb_Replset
    def self.configure(members, name)
      require 'rubygems'
      require 'mongo'

      connection = Mongo::Connection.new('localhost', 27017, :op_timeout => 30, :slave_ok => true)
      admin = connection['admin']
      cmd = BSON::OrderedHash.new

      rs_member_ips = []

      members.each_index do |n|
        rs_member_ips << { _id: n, host: "#{members[n]}:27017" }
      end

      cmd['replSetInitiate'] = {
           _id: name,
           members: rs_member_ips
      }

      result = admin.command(cmd, :check_response => false)
    end
  end
end
<commit_msg>Updating libraries to work with newer gems<commit_after>require 'json'

class Chef
  class Mongodb_Replset
    def self.configure(members, name)
      require 'rubygems'
      require 'mongo'

      connection = Mongo::Client.new([ 'localhost:27017' ], :socket_timeout => 30, :slave_ok => true)
      admin = connection.database
      cmd = BSON::Document.new

      rs_member_ips = []

      members.each_index do |n|
        rs_member_ips << { _id: n, host: "#{members[n]}:27017" }
      end

      cmd['replSetInitiate'] = {
           _id: name,
           members: rs_member_ips
      }

      result = admin.command(cmd, :check_response => false)
    end
  end
end

{'fraction_non_alphanumeric': 0.11805026656511805, 'fraction_numerical': 0.01827875095201828, 'mean_word_length': 2.5609756097560976, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '249032', 'n_tokens_mistral': 455, 'n_tokens_neox': 420, 'n_words': 98}