class Realm::Persistence
Public Class Methods
new(container, repositories)
click to toggle source
# File lib/realm/persistence.rb, line 24 def initialize(container, repositories) @container = container @repositories = repositories end
setup(...)
click to toggle source
# File lib/realm/persistence.rb, line 20 def self.setup(...) new(...).setup end
Public Instance Methods
setup()
click to toggle source
# File lib/realm/persistence.rb, line 29 def setup register_repos end
Private Instance Methods
constantize(*parts)
click to toggle source
# File lib/realm/persistence.rb, line 45 def constantize(*parts) return parts[0] unless parts[0].is_a?(String) parts.join('::').safe_constantize end
gateway()
click to toggle source
# File lib/realm/persistence.rb, line 35 def gateway @gateway ||= @container.resolve('persistence.gateway') end
register_repos()
click to toggle source
# File lib/realm/persistence.rb, line 39 def register_repos @repositories.each do |repo_class| @container.register_factory(repo_class, gateway, as: "#{repo_class.name.demodulize.underscore}_repo") end end