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-repository environment given a repository type provided
  under the ROM umbrella. For custom repositories, create an instance and
  pass it directly.

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

@overload setup(repository)
  @param [Repository] repository

@overload setup(repositories)
  Sets up multiple repositories.

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

@return [Setup] boot object

@example
  # Use the in-memory adapter shipped with ROM as the default repository.
  env = ROM.setup(:memory, 'memory://test')
  # Use `rom-sql` with an in-memory sqlite database as default repository.
  ROM.setup(:sql, 'sqlite::memory')
  # Registers a `default` and a `warehouse` repository.
  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.