Class: Rails::DataMapper::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/dm-rails/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#rawObject

Returns the value of attribute raw.



11
12
13
# File 'lib/dm-rails/configuration.rb', line 11

def raw
  @raw
end

#rootObject

Returns the value of attribute root.



12
13
14
# File 'lib/dm-rails/configuration.rb', line 12

def root
  @root
end

Class Method Details

.createObject



14
15
16
# File 'lib/dm-rails/configuration.rb', line 14

def self.create
  Rails::DataMapper.configuration ||= new
end

Instance Method Details

#environmentsObject



18
19
20
# File 'lib/dm-rails/configuration.rb', line 18

def environments
  raw.keys
end

#field_naming_conventionObject



38
39
40
# File 'lib/dm-rails/configuration.rb', line 38

def field_naming_convention
  @field_naming_convention ||= {}
end

#repositoriesObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/dm-rails/configuration.rb', line 22

def repositories
  @repositories ||= raw.reject { |k,v| k =~ /defaults/ }.inject({}) do |repositories, pair|
    environment, config = pair.first, pair.last
    repositories[environment] = begin
      c = config['repositories'] || {}
      c['default'] = config.except('repositories') if config.except('repositories')
      normalize_repository_config(c)
    end
    repositories
  end
end

#resource_naming_conventionObject



34
35
36
# File 'lib/dm-rails/configuration.rb', line 34

def resource_naming_convention
  @resource_naming_convention ||= {}
end