Module: Magik::Model

Defined in:
lib/magik/model.rb

Overview

The model DSL — a thin, explicit wrapper over Sequel. No lazy-loading magic, no implicit N+1.

Implements: Phase 1 — Foundation of docs/idea/00-build-spec.md.

Planned DSL surface, copied from the spec:

  • model :Name do field/computed/belongs_to/has_many/validate/scope end
  • computed(:name, :type) { ... } — the parens are load-bearing: a brace block binds to the last call, so without them it binds to the symbol
  • :money field type, integer-cents backed (floats forbidden)
  • :file field type — an attachment; max_size: and content_types: required
  • :duration field type — a unit-suffixed string coerced at boot ("14d")
  • UUIDv7 primary keys
  • tenant_id auto-injection

Status: Not implemented — spec only. Every entry point below raises NotImplementedError. Nothing here reads config, touches a database or emits a byte of HTML.

See Also:

Constant Summary collapse

SPEC_PHASE =

The build-spec phase this subsystem implements.

Returns:

  • (String)
"Phase 1 — Foundation"
DSL_SURFACE =

The DSL this subsystem will expose, verbatim from the spec.

Returns:

  • (Array<String>)
[
  "model :Name do field/computed/belongs_to/has_many/validate/scope end",
  "computed(:name, :type) { ... } — a derived field",
  ":money field type, integer-cents backed (floats forbidden)",
  ":file field type — an attachment, max_size: and content_types: required",
  ":duration field type — a unit-suffixed string coerced at boot",
  "UUIDv7 primary keys",
  "tenant_id auto-injection"
].freeze
STATUS =

Implementation status of this subsystem.

Returns:

  • (String)
"Not implemented — spec only"

Class Method Summary collapse

Class Method Details

.define(*_args, **_options) ⇒ void

This method returns an undefined value.

Entry point for the Model DSL.

Parameters:

  • _args (Array) —

    ignored

  • _options (Hash) —

    ignored

Raises:

  • (NotImplementedError) —

    always, until Phase 1 lands



52
53
54
# File 'lib/magik/model.rb', line 52

def self.define(*_args, **_options)
  raise NotImplementedError, "Magik::Model is spec-only; see docs/idea/00-build-spec.md"
end