Sha256: da5cc921e0fb763aeec4dbc3fdc457f00e3f70a5edec562899777af4c79ec2d4

Contents?: true

Size: 403 Bytes

Versions: 2

Compression:

Stored size: 403 Bytes

Contents

require "jamjar/model"
require "jamjar/version"

module JamJar
  @@table_count = 0

  def self.model
    model = Class.new(JamJar::Model)

    model.table_name = "table_#{@@table_count}"
    @@table_count += 1

    model.establish_connection adapter: "sqlite3", database: ":memory:"
    model.connection.create_table(model.table_name)
    model.class_eval(&Proc.new) if block_given?
    model
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jamjar-1.2.0 lib/jamjar.rb
jamjar-1.1.0 lib/jamjar.rb