Class: Sequelizer::Options
- Inherits:
-
Object
- Object
- Sequelizer::Options
- Defined in:
- lib/sequelizer/options.rb
Overview
Options
Manages database connection options from multiple configuration sources. This class is responsible for:
- Loading configuration from various sources (YAML files, environment variables, .env files)
- Applying precedence rules for configuration sources
- Processing adapter-specific options (especially PostgreSQL schema handling)
- Managing Sequel extensions
- Setting up after_connect callbacks
Configuration Sources (in order of precedence)
- Passed options (highest priority)
- .env file
- Environment variables
- config/database.yml
- ~/.config/sequelizer/database.yml (lowest priority)
Instance Attribute Summary collapse
-
#extensions ⇒ Object
readonly
Returns the value of attribute extensions.
Instance Method Summary collapse
-
#initialize(options = nil) ⇒ Options
constructor
Creates a new Options instance, processing configuration from multiple sources.
-
#to_hash ⇒ Hash
Returns the processed options as a hash suitable for Sequel.connect.
Constructor Details
#initialize(options = nil) ⇒ Options
Creates a new Options instance, processing configuration from multiple sources.
46 47 48 49 |
# File 'lib/sequelizer/options.rb', line 46 def initialize( = nil) opts = () @options, @extensions = filter_extensions(opts) end |
Instance Attribute Details
#extensions ⇒ Object (readonly)
Returns the value of attribute extensions.
38 39 40 |
# File 'lib/sequelizer/options.rb', line 38 def extensions @extensions end |
Instance Method Details
#to_hash ⇒ Hash
Returns the processed options as a hash suitable for Sequel.connect.
54 55 56 |
# File 'lib/sequelizer/options.rb', line 54 def to_hash @options end |