Module: DataMapper::Adapters

Defined in:
lib/dm-constraints.rb

Overview

module Constraints

Defined Under Namespace

Classes: AbstractAdapter

Class Method Summary collapse

Class Method Details

.constraint_module(const_name) ⇒ Object



67
68
69
# File 'lib/dm-constraints.rb', line 67

def self.constraint_module(const_name)
  Constraints::Adapters.const_get(const_name)
end

.include_constraint_api(const_name) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/dm-constraints.rb', line 56

def self.include_constraint_api(const_name)
  require constraint_extensions(const_name)
  if Constraints::Adapters.const_defined?(const_name)
    adapter = const_get(const_name)
    adapter.send(:include, constraint_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 constraints
end