Class: SequelRails::Configuration

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



18
19
20
# File 'lib/sequel_rails/configuration.rb', line 18

def logger
  @logger
end

#migration_dirObject

Returns the value of attribute migration_dir.



19
20
21
# File 'lib/sequel_rails/configuration.rb', line 19

def migration_dir
  @migration_dir
end

#rawObject (readonly)

Returns the value of attribute raw.



17
18
19
# File 'lib/sequel_rails/configuration.rb', line 17

def raw
  @raw
end

#rootObject (readonly)

Returns the value of attribute root.



17
18
19
# File 'lib/sequel_rails/configuration.rb', line 17

def root
  @root
end

Class Method Details

.for(root, database_yml_hash) ⇒ Object



13
14
15
# File 'lib/sequel_rails/configuration.rb', line 13

def self.for(root, database_yml_hash)
  ::SequelRails.configuration ||= new(root, database_yml_hash)
end

Instance Method Details

#environment_for(name) ⇒ Object



21
22
23
# File 'lib/sequel_rails/configuration.rb', line 21

def environment_for(name)
  environments[name.to_s] || environments[name.to_sym]
end

#environmentsObject



25
26
27
28
29
30
31
# File 'lib/sequel_rails/configuration.rb', line 25

def environments
  @environments ||= @raw.inject({}) do |normalized, environment|
    name, config = environment.first, environment.last
    normalized[name] = normalize_repository_config(config)
    normalized
  end
end