class Realm::ROM::Gateway
Public Class Methods
new(url:, root_module:, class_path:, migration_path:, **)
click to toggle source
# File lib/realm/rom/gateway.rb, line 6 def initialize(url:, root_module:, class_path:, migration_path:, **) @url = url @root_module = root_module @class_path = class_path @migration_path = migration_path end
Public Instance Methods
health()
click to toggle source
# File lib/realm/rom/gateway.rb, line 13 def health issues = [] issues << 'Cannot connect to db' unless default_gateway.connection.test_connection issues << 'Pending migrations' if default_gateway.migrator.pending? HealthStatus.from_issues(issues) end
method_missing(...)
click to toggle source
# File lib/realm/rom/gateway.rb, line 20 def method_missing(...) client.send(...) end
respond_to_missing?(...)
click to toggle source
# File lib/realm/rom/gateway.rb, line 24 def respond_to_missing?(...) client.respond_to?(...) end
Private Instance Methods
client()
click to toggle source
# File lib/realm/rom/gateway.rb, line 30 def client @client ||= ::ROM.container(config) end
config()
click to toggle source
# File lib/realm/rom/gateway.rb, line 34 def config ::ROM::Configuration.new(:sql, @url, **config_options).tap do |config| config.auto_registration(@class_path, namespace: @root_module.to_s) end end
config_options()
click to toggle source
# File lib/realm/rom/gateway.rb, line 40 def config_options { search_path: @root_module.to_s.underscore, migrator: { path: @migration_path } } end
default_gateway()
click to toggle source
# File lib/realm/rom/gateway.rb, line 44 def default_gateway client.gateways[:default] end