Module: Spectacles

Defined in:
lib/spectacles.rb,
lib/spectacles/view.rb,
lib/spectacles/railtie.rb,
lib/spectacles/version.rb,
lib/spectacles/configuration.rb,
lib/spectacles/schema_dumper.rb,
lib/spectacles/materialized_view.rb,
lib/spectacles/schema_statements.rb,
lib/spectacles/schema_statements/mysql2_adapter.rb,
lib/spectacles/schema_statements/sqlite3_adapter.rb,
lib/spectacles/schema_statements/vertica_adapter.rb,
lib/spectacles/schema_statements/abstract_adapter.rb,
lib/spectacles/schema_statements/sqlserver_adapter.rb,
lib/spectacles/schema_statements/postgresql_adapter.rb

Defined Under Namespace

Modules: SchemaDumper, SchemaStatements Classes: Configuration, MaterializedView, Railtie, View

Constant Summary collapse

VERSION =
"7.2.0"
SUPPORTED_ADAPTERS =
%w[Mysql2 PostgreSQL SQLServer SQLite SQLite3 Vertica]

Class Method Summary collapse

Class Method Details

.configurationObject Also known as: config



16
17
18
# File 'lib/spectacles.rb', line 16

def self.configuration
  @configuration ||= ::Spectacles::Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



20
21
22
# File 'lib/spectacles.rb', line 20

def self.configure
  yield(configuration) if block_given?
end

.load_adaptersObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/spectacles/schema_statements.rb', line 6

def self.load_adapters
  SUPPORTED_ADAPTERS.each do |db|
    adapter_class = "#{db}Adapter"

    if ActiveRecord::ConnectionAdapters.const_defined?(adapter_class)
      require "spectacles/schema_statements/#{db.downcase}_adapter"

      adapter = ActiveRecord::ConnectionAdapters.const_get(adapter_class)
      extension = Spectacles::SchemaStatements.const_get(adapter_class)

      adapter.send :prepend, extension
    end
  end
end