Module: Superhosting::CompositeMapper

Defined in:
lib/superhosting/composite_mapper.rb,
lib/superhosting/composite_mapper/base.rb,
lib/superhosting/composite_mapper/site.rb,
lib/superhosting/composite_mapper/container.rb

Defined Under Namespace

Classes: Base, Container, Site

Class Method Summary collapse

Class Method Details

.new(etc_mapper:, lib_mapper:, web_mapper:) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/superhosting/composite_mapper.rb', line 3

def self.new(etc_mapper:, lib_mapper:, web_mapper:)
  klass = case type = etc_mapper.parent.name
    when 'containers' then Container
    when 'sites' then Site
    else raise NetStatus::Exception, { error: :logical_error, code: :mapper_type_not_supported, data: { name: type } }
  end
  klass.new(etc_mapper: etc_mapper, lib_mapper: lib_mapper, web_mapper: web_mapper)
end