<commit_before>require 'couchrest'
require 'json'

require 'ostruct'

JSON.create_id = 'ruby_class'
CouchRest.decode_json_objects = true

module CouchPotato
  Config = Struct.new(:database_host, :database_name, :split_design_documents_per_view, :default_language).new
  Config.split_design_documents_per_view = false
  Config.default_language = :javascript
  Config.database_host = "http://127.0.0.1:5984"

  class NotFound < StandardError; end
  class Conflict < StandardError; end

  # returns all the classes that include the CouchPotato::Persistence module
  def self.models
    @models ||= []
    @models
  end

  # Returns a database instance which you can then use to create objects and query views. You have to set the CouchPotato::Config.database_name before this works.
  def self.database
    @@__database ||= Database.new(self.couchrest_database)
  end

  # Returns the underlying CouchRest database object if you want low level access to your CouchDB. You have to set the CouchPotato::Config.database_name before this works.
  def self.couchrest_database
    @@__couchrest_database ||= CouchRest.database(full_url_to_database(CouchPotato::Config.database_name, CouchPotato::Config.database_host))<commit_msg>Add default header to couch request (#129)<commit_after>require 'couchrest'
require 'json'

require 'ostruct'

JSON.create_id = 'ruby_class'
CouchRest.decode_json_objects = true
CouchRest::Connection::DEFAULT_HEADERS.merge!('Prefer' => 'return=minimal')

module CouchPotato
  Config = Struct.new(:database_host, :database_name, :split_design_documents_per_view, :default_language).new
  Config.split_design_documents_per_view = false
  Config.default_language = :javascript
  Config.database_host = "http://127.0.0.1:5984"

  class NotFound < StandardError; end
  class Conflict < StandardError; end

  # returns all the classes that include the CouchPotato::Persistence module
  def self.models
    @models ||= []
    @models
  end

  # Returns a database instance which you can then use to create objects and query views. You have to set the CouchPotato::Config.database_name before this works.
  def self.database
    @@__database ||= Database.new(self.couchrest_database)
  end

  # Returns the underlying CouchRest database object if you want low level access to your CouchDB. You have to set the CouchPotato::Config.database_name before this works.
  def self.couchrest_database
    @@__couchrest_database ||= CouchRest.database(full_url_to_database(CouchPotato::Config.database_name, CouchPotato::Config.database_host))
{'fraction_non_alphanumeric': 0.0840204161758932, 'fraction_numerical': 0.009030231645072634, 'mean_word_length': 5.385964912280702, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6569795', 'n_tokens_mistral': 799, 'n_tokens_neox': 753, 'n_words': 213}