Class: Migratio::Config
- Inherits:
-
Object
- Object
- Migratio::Config
- Defined in:
- lib/migratio/config.rb
Instance Method Summary collapse
- #default_config_path ⇒ Object
-
#initialize(path = nil) ⇒ Config
constructor
A new instance of Config.
- #name ⇒ Object
- #namespace ⇒ Object
- #redis_url ⇒ Object
Constructor Details
#initialize(path = nil) ⇒ Config
Returns a new instance of Config.
7 8 9 10 11 12 13 14 15 |
# File 'lib/migratio/config.rb', line 7 def initialize(path=nil) config_path = path || default_config_path if File.exists?(config_path) @config = YAML.load_file(config_path) else @config = {} end end |
Instance Method Details
#default_config_path ⇒ Object
29 30 31 |
# File 'lib/migratio/config.rb', line 29 def default_config_path File.join(ROOT_PATH, 'config.yml') end |
#name ⇒ Object
25 26 27 |
# File 'lib/migratio/config.rb', line 25 def name @config['name'] || 'name' end |
#namespace ⇒ Object
21 22 23 |
# File 'lib/migratio/config.rb', line 21 def namespace @config['namespace'] || 'air' end |
#redis_url ⇒ Object
17 18 19 |
# File 'lib/migratio/config.rb', line 17 def redis_url @config['redis_url'] || 'redis://localhost:6379' end |