class Skein::Config
Constants
- CONFIG_PATH_DEFAULT
Constants ============================================================¶ ↑
- DEFAULTS
- DRIVERS
- DRIVER_DEFAULT
- DRIVER_PLATFORM_DEFAULT
- ENV_DEFAULT
Public Class Methods
env()
click to toggle source
# File lib/skein/config.rb, line 45 def self.env if (defined?(Rails)) Rails.env.to_s else ENV['RAILS_ENV'] || ENV_DEFAULT end end
exist?()
click to toggle source
# File lib/skein/config.rb, line 57 def self.exist? File.exist?(self.path) end
new(options = nil)
click to toggle source
Instance Methods =====================================================¶ ↑
Calls superclass method
# File lib/skein/config.rb, line 63 def initialize(options = nil) config_path = nil case (options) when String if (File.exist?(options)) config_path = options end when Hash super( DEFAULTS.merge( Hash[ options.map do |k, v| [ k.nil? ? nil : k.to_sym, v ] end ] ) ) return when false, :default # Ignore configuration file, use defaults else config_path = File.expand_path('config/skein.yml', self.class.root) end if (config_path and File.exist?(config_path)) super(DEFAULTS.merge( YAML.load_file(config_path, aliases: true)[self.class.env] || { } )) else super(DEFAULTS) end end
path()
click to toggle source
# File lib/skein/config.rb, line 53 def self.path File.expand_path(CONFIG_PATH_DEFAULT, self.root) end