Module: DataMapper::Adapters

Defined in:
lib/dm-aggregates.rb

Class Method Summary collapse

Class Method Details

.aggregate_module(const_name) ⇒ Object



35
36
37
# File 'lib/dm-aggregates.rb', line 35

def self.aggregate_module(const_name)
  Aggregates.const_get(const_name)
end

.include_aggregate_api(const_name) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/dm-aggregates.rb', line 24

def self.include_aggregate_api(const_name)
  require aggregate_extensions(const_name)
  if Aggregates.const_defined?(const_name)
    adapter = const_get(const_name)
    adapter.send(:include, aggregate_module(const_name))
  end
rescue LoadError
  # Silently ignore the fact that no adapter extensions could be required
  # This means that the adapter in use doesn't support aggregates
end