Skip to content

Commit

Permalink
Introduce Repo class (#6)
Browse files Browse the repository at this point in the history
The bulk of the integration code will be in hanami/hanami, so we’re keeping that alongside the app integration code for actions and views.

This leaves just a simple skeleton class to reside in hanami-db for now.
  • Loading branch information
timriley authored May 31, 2024
1 parent eaca280 commit 2932c33
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions lib/hanami/db/repo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# frozen_string_literal: true

module Hanami
module DB
# @api public
# @since 2.2.0
class Repo < ROM::Repository
# @api public
# @since 2.2.0
defines :root

# @api public
# @since 2.2.0
attr_reader :root

# @api private
def self.inherited(klass)
super
klass.root(root)
end

# @api public
# @since 2.2.0
def initialize(*, **)
super

@root = set_relation(self.class.root) if self.class.root
end
end
end
end

0 comments on commit 2932c33

Please sign in to comment.