ROM::Environment#setup

Parsed documentation:
View on GitHub
Starts the setup process for relations, mappers and commands.

@overload setup(type, *args)
  Sets up a single-gateway environment given a gateway type provided
  under the ROM umbrella. For custom gateways, create an instance and
  pass it directly.

  @param [Symbol] type
  @param [Array] *args

@overload setup(gateway)
  @param [Gateway] gateway

@overload setup(gateways)
  Sets up multiple gateways.

  @param [Hash{Symbol=>Symbol,Array}] gateways

@return [Setup] boot object

@example
  # Use the in-memory adapter shipped with ROM as the default gateway.
  rom = ROM::Environment.new
  env = rom.setup(:memory, 'memory://test')
  # Use `rom-sql` with an in-memory sqlite database as default gateway.
  rom.setup(:sql, 'sqlite::memory')
  # Registers a `default` and a `warehouse` gateway.
  env = rom.setup(
    default: [:sql, 'sqlite::memory'],
    warehouse: [:sql, 'postgres://localhost/warehouse']
  )

@example A full environment

  rom = ROM::Environment.new
  rom.setup(:memory, 'memory://test')

  rom.relation(:users) do
    # ...
  end

  rom.mappers do
    define(:users) do
      # ...
    end
  end

  rom.commands(:users) do
    define(:create) do
      # ...
    end
  end

  rom.finalize # builds the container
  rom.container # returns the container registry

@api public
Suggestions:
Please help! Open an issue on GitHub if this assessment is incorrect.