ROM::Global#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.
  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.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 env
  ROM.env # returns the env registry

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