class ROM::Schema

Schema builder DSL

Public Class Methods

build(repositories, &block) click to toggle source

Build a relation schema

@example

Schema.build do
  base_relation :users do
    repository :test
    attribute :id, :name
  end
end

@return [Schema]

@api public

# File lib/rom/schema.rb, line 24
def self.build(repositories, &block)
  new(Definition.new(repositories, &block))
end

Public Instance Methods

[](name) click to toggle source

Return defined relation identified by name

@example

schema[:users] # => #<Axiom::Relation::Base ..>

@return [Axiom::Relation, Axiom::Relation::Base]

@api public

# File lib/rom/schema.rb, line 37
def [](name)
  definition[name]
end
call(&block) click to toggle source

@api private

# File lib/rom/schema.rb, line 42
def call(&block)
  definition.instance_eval(&block)
  self
end