Sha256: 43bd7c98a36e69a99a872c8c2910abf21db70d9c43228f318ac3c91bee1c57b9

Contents?: true

Size: 746 Bytes

Versions: 5

Compression:

Stored size: 746 Bytes

Contents

module RailsDb
  class Database
    extend Connection

    def self.tables
      connection.tables.sort - ['schema_migrations']
    end

    def self.accessible_tables
      tables = Database.tables
      if Array.wrap(RailsDb.white_list_tables) != []
        tables = tables & RailsDb.white_list_tables
      end
      if Array.wrap(RailsDb.black_list_tables) != []
        tables = tables - RailsDb.black_list_tables
      end
      tables
    end

    def self.adapter
      case connection.class.to_s
      when /Mysql/
        RailsDb::Adapters::Mysql
      when /Postgre/
        RailsDb::Adapters::Postgres
      when /SQLite/
        RailsDb::Adapters::Sqlite
      else
        RailsDb::Adapters::BaseAdapter
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_db-0.6 lib/rails_db/database.rb
rails_db-0.5.1 lib/rails_db/database.rb
rails_db-0.5 lib/rails_db/database.rb
rails_db-0.4 lib/rails_db/database.rb
rails_db-0.3 lib/rails_db/database.rb