module Apartment

def configure

configure apartment with available options
def configure
  yield self if block_given?
end

def connection_class

def connection_class
  @connection_class || ActiveRecord::Base
end

def database_names

Be careful not to use `return` here so both Proc and lambda can be used without breaking
def database_names
  @database_names.respond_to?(:call) ? @database_names.call : @database_names
end

def database_schema_file

def database_schema_file
  return @database_schema_file if defined?(@database_schema_file)
  @database_schema_file = Rails.root.join('db', 'schema.rb')
end

def default_schema

def default_schema
  @default_schema || "public"
end

def excluded_models

Default to empty array
def excluded_models
  @excluded_models || []
end

def persistent_schemas

def persistent_schemas
  @persistent_schemas || []
end

def reset

Reset all the config for Apartment
def reset
  (ACCESSOR_METHODS + WRITER_METHODS).each{|method| remove_instance_variable(:"@#{method}") if instance_variable_defined?(:"@#{method}") }
end

def use_postgres_schemas

def use_postgres_schemas
  warn "[Deprecation Warning] `use_postgresql_schemas` is now deprecated, please use `use_schemas`"
  use_schemas
end

def use_postgres_schemas=(to_use_or_not_to_use)

def use_postgres_schemas=(to_use_or_not_to_use)
  warn "[Deprecation Warning] `use_postgresql_schemas=` is now deprecated, please use `use_schemas=`"
  self.use_schemas = to_use_or_not_to_use
end