Module: ProjectAdapter

Included in:
Project
Defined in:
app/concerns/project_adapter.rb

Defined Under Namespace

Classes: Adapter

Instance Method Summary collapse

Instance Method Details

#adaptersObject



4
5
6
# File 'app/concerns/project_adapter.rb', line 4

def adapters
  @adapters ||= {}
end

#has_adapter(*adapter_namespaces) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/concerns/project_adapter.rb', line 9

def has_adapter(*adapter_namespaces)
  adapter_namespaces.each do |adapter_namespace|
    adapter_module = Houston::Adapters[adapter_namespace]
    raise ArgumentError, "#{adapter_module} should respond to `adapters`" unless adapter_module.respond_to?(:adapters)
    raise ArgumentError, "#{adapter_module} should respond to `adapter`" unless adapter_module.respond_to?(:adapter)

    adapter = Adapter.new(self, adapter_module)
    adapters[adapter.name] = adapter

    adapter.define_methods!

    validate adapter.validation_method
  end
end