Class: Migratio::Config

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

Instance Method Summary collapse

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_pathObject



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

def default_config_path
  File.join(ROOT_PATH, 'config.yml')
end

#nameObject



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

def name
  @config['name'] || 'name'
end

#namespaceObject



21
22
23
# File 'lib/migratio/config.rb', line 21

def namespace
  @config['namespace'] || 'air'
end

#redis_urlObject



17
18
19
# File 'lib/migratio/config.rb', line 17

def redis_url
  @config['redis_url'] || 'redis://localhost:6379'
end