Sha256: 019829e5778385c1457c9b17a5e0ee08a87b96ce0932996b3504c807a81bfec0
Contents?: true
Size: 900 Bytes
Versions: 4
Compression:
Stored size: 900 Bytes
Contents
class Baza::Database include Baza::DatabaseModelFunctionality attr_reader :db, :driver, :name_was attr_accessor :name def initialize(args) @db = args.fetch(:db) @driver = args.fetch(:driver) @name = args.fetch(:name) @name_was = @name end def tables(args = {}) list_args = {database: name} list_args[:name] = args.fetch(:name) if args[:name] ArrayEnumerator.new do |yielder| @db.tables.list(list_args) do |table| yielder << table end end end def table(name) table = tables(name: name).first raise Baza::Errors::TableNotFound unless table table end def table_exists?(name) table(name) true rescue Baza::Errors::TableNotFound false end def save! raise Baza::Errors::NotImplemented end def to_param name end def use(&blk) @db.databases.with_database(name, &blk) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
baza-0.0.24 | lib/baza/database.rb |
baza-0.0.23 | lib/baza/database.rb |
baza-0.0.22 | lib/baza/database.rb |
baza-0.0.21 | lib/baza/database.rb |