From 15af2d7e89ddd2de68851952f477ad6d54c86031 Mon Sep 17 00:00:00 2001 From: DualFroz Date: Tue, 25 Aug 2026 17:00:00 +0200 Subject: [PATCH] feat(orm): add orm entrypoint with connection and migrator helpers --- lib/prism/orm.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 lib/prism/orm.rb diff --git a/lib/prism/orm.rb b/lib/prism/orm.rb new file mode 100644 index 0000000..cd86691 --- /dev/null +++ b/lib/prism/orm.rb @@ -0,0 +1,30 @@ +require_relative 'orm/store' +require_relative 'orm/errors' +require_relative 'orm/relation' +require_relative 'orm/validatable' +require_relative 'orm/associable' +require_relative 'orm/model' +require_relative 'orm/migration' +require_relative 'orm/migrator' + +module Prism + module Orm + class << self + def connect(path) + @store = Store.new(path) + end + + def store + @store || raise('Prism::Orm.connect(path) was not called yet') + end + + def migrator(migrations_path) + Migrator.new(store, migrations_path) + end + + def transaction(&block) + store.transaction(&block) + end + end + end +end