Module: EntitySchema::Contracts

Defined in:
lib/entity_schema/contracts/common.rb,
lib/entity_schema/contracts/object.rb,
lib/entity_schema/contracts/contract.rb,
lib/entity_schema/contracts/property.rb,
lib/entity_schema/contracts/belongs_to.rb,
lib/entity_schema/contracts/collection.rb,
lib/entity_schema/contracts/fk_belongs_to.rb,
lib/entity_schema/contracts/object_belongs_to.rb

Defined Under Namespace

Classes: Contract

Constant Summary collapse

Common =
Contract.build(
  { type: Symbol },
  key:     { eq: [nil], type: Symbol },
  getter:  { eq: [:private, nil] },
  setter:  { eq: [:private, nil] },
  private: { eq: [true, false, :getter, :setter, nil] }
)
Object =
Common + [
  { type: Symbol },
  { type: Class, eq: [nil] },
  mapper:     { type: Symbol, eq: [nil], respond_to: :call },
  map_to:     { type: Class,  eq: [nil] },
  map_method: { type: Symbol, eq: [nil] },
  serializer: { type: Symbol, eq: [nil], respond_to: :call },
  serialize:  { type: Symbol, eq: [nil] }
]
Property =
Common + [
  predicate: { eq: [true, false, nil] }
]
BelongsTo =
FkBelongsTo + ObjectBelongsTo + [
  fk: { eq: [nil], type: Symbol },
  pk: { eq: [nil], type: Symbol }
]
Collection =
Object
FkBelongsTo =
Common
ObjectBelongsTo =
Object