Class: Everywhere::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/everywhere.rb

Overview

App-facing runtime configuration. Apps register overrides at load time:

# config/initializers/everywhere.rb (Rails) or anywhere loaded by config.ru
Everywhere.configure do |c|
c.database { MyMigrator.run! }   # override the default ORM-driven prep
end

Read back by the boot path (Everywhere::Database, etc.).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#database_hookObject (readonly)

A callable that fully owns database preparation. When set, it replaces the ORM auto-detection in Everywhere::Database entirely.



25
26
27
# File 'lib/everywhere.rb', line 25

def database_hook
  @database_hook
end

#sequel_dbObject

An explicit Sequel database handle for frameworks (e.g. Hanami) where the connection lives inside a container rather than a top-level constant.



29
30
31
# File 'lib/everywhere.rb', line 29

def sequel_db
  @sequel_db
end

Instance Method Details

#database(&block) ⇒ Object



31
32
33
# File 'lib/everywhere.rb', line 31

def database(&block)
  @database_hook = block
end