Module: Snails

Defined in:
runtime/snails/application.rb,
runtime/snails/application.rbs,
runtime/snails/cache.rbs,
runtime/snails/date_and_time/calculations.rbs,
runtime/snails/duration.rbs,
runtime/snails/env.rbs,
runtime/snails/error_boundary.rbs,
runtime/snails/form.rbs,
runtime/snails/form/errors.rbs,
runtime/snails/form/rule_engine.rbs,
runtime/snails/form/rule_options.rbs,
runtime/snails/harness.rbs,
runtime/snails/health_controller.rbs,
runtime/snails/logger.rbs,
runtime/snails/logger/context.rbs,
runtime/snails/logger/delivery.rbs,
runtime/snails/logger/formatter.rbs,
runtime/snails/logger/log_delivery_job.rbs,
runtime/snails/logger/otlp_transport.rbs,
runtime/snails/logger/record.rbs,
runtime/snails/logger/record_formatter.rbs,
runtime/snails/main/dispatch.rbs,
runtime/snails/main/server.rbs,
runtime/snails/queue_job.rbs,
runtime/snails/queue_occurrence.rbs,
runtime/snails/queue_prune_job.rbs,
runtime/snails/root_path.rbs,
runtime/snails/route_dsl.rbs,
runtime/snails/time_zone.rbs,
runtime/snails/version.rbs,
runtime/snails/cache.rb,
runtime/snails/date_and_time/calculations.rb,
runtime/snails/duration.rb,
runtime/snails/env.rb,
runtime/snails/error_boundary.rb,
runtime/snails/form.rb,
runtime/snails/form/errors.rb,
runtime/snails/form/rule_engine.rb,
runtime/snails/form/rule_options.rb,
runtime/snails/harness.rb,
runtime/snails/health_controller.rb,
runtime/snails/logger.rb,
runtime/snails/logger/context.rb,
runtime/snails/logger/delivery.rb,
runtime/snails/logger/formatter.rb,
runtime/snails/logger/log_delivery_job.rb,
runtime/snails/logger/otlp_transport.rb,
runtime/snails/logger/record.rb,
runtime/snails/logger/record_formatter.rb,
runtime/snails/main/dispatch.rb,
runtime/snails/main/server.rb,
runtime/snails/queue_job.rb,
runtime/snails/queue_occurrence.rb,
runtime/snails/queue_prune_job.rb,
runtime/snails/root_path.rb,
runtime/snails/route_dsl.rb,
runtime/snails/schema_loader.rb,
runtime/snails/time_zone.rb,
runtime/snails/utils.rb,
runtime/snails/version.rb

Overview

Framework version metadata — the version and revision of the core that is actually running. publish-dist.sh rewrites the two constants when it packages a release; sync copies the vendored file, so the values name the code in the binary rather than the app's pin declaration. A checkout sync stamps the resolved revision into the app's vendored copy.

Defined Under Namespace

Modules: DateAndTime, ErrorBoundary, Harness, HarnessRunner, Main, RouteTable, SchemaLoader, TimeZone, Utils Classes: AppPath, Application, Cache, Duration, Env, Form, HealthController, LogDeliveryJob, Logger, QueueJob, QueueOccurrence, QueuePruneJob

Constant Summary collapse

VERSION =

The core version: a release tag (v0.20.0) or a full commit revision for an edge pin. "unknown" in a checkout that was never stamped.

"unknown"
REV =

The exact core revision, full 40-hex when known.

"unknown"

Class Method Summary collapse

Class Method Details

.app ⇒ Application

the app's settings object, built once. The readers live on the app's Snails::Application reopen (config/ application.rb); memoizing makes it the one read channel rather than a per-call view.

Returns:



12
# File 'runtime/snails/application.rb', line 12

def self.app: () -> Application

.cache ⇒ Cache

the process-wide store, memoized so every call answers the same instance (a fresh Cache.new would make every fetch a miss).

Returns:



23
# File 'runtime/snails/cache.rb', line 23

def self.cache: () -> Cache

.env ⇒ Env

the process mode, read once from SNAILS_ENV and memoized. Development is the default when unset (a deployment sets SNAILS_ENV=production, a harness test.env sets SNAILS_ENV=test).

Returns:

  • (Env) —

    the mode predicates



12
# File 'runtime/snails/env.rb', line 12

def self.env: () -> Env

.env=(name) ⇒ Env

replace the process mode in-process (a test, a console-style override). A deployment sets SNAILS_ENV before the process starts; there is no separate env-name slot.

Parameters:

  • name (String, nil) —

    a vocabulary name, or nil for development

Returns:

  • (Env) —

    the new mode



22
# File 'runtime/snails/env.rb', line 22

def self.env=: (String? name) -> Env

.iana_zone(name) ⇒ String

the IANA identifier for a zone name in the runtime's zone vocabulary ("Seoul" → "Asia/Seoul"), or an IANA identifier passed through as-is. The identifier must name a zone file under TZDIR: a typo in the app's pin raises here instead of letting libc fall back to UTC silently.

Examples:

Snails.iana_zone("Seoul") # => "Asia/Seoul"

Parameters:

  • name (String) —

    the configured zone name

Returns:

  • (String) —

    the IANA identifier

Raises:

  • (ArgumentError) —

    the name is neither a registered zone name nor an IANA identifier with a zone file



23
# File 'runtime/snails/time_zone.rb', line 23

def self.iana_zone: (String name) -> String

.logger ⇒ Logger

the process-wide logger. Memoized so the slots set in config/environment.rb land on the same object every call writes through.

Returns:

  • (Logger) —

    the shared logger



38
# File 'runtime/snails/logger.rb', line 38

def self.logger: () -> Snails::Logger

.rev ⇒ String

the exact framework revision the running core was packaged from.

Returns:

  • (String) —

    the full commit revision, "unknown" when unstamped



26
# File 'runtime/snails/version.rb', line 26

def self.rev: () -> String

.root ⇒ AppPath

the app root.

This is app-facing surface: the runtime itself does not read it, but app code uses it for paths under the root.

Examples:

"#{Snails.root}/tmp"                    # => "./tmp"
Snails.root.join("tmp", "storage").to_s # => "./tmp/storage"

Returns:

  • (AppPath) —

    the app root, relative to the process working directory



14
# File 'runtime/snails/root_path.rb', line 14

def self.root: () -> AppPath

.time_zone ⇒ String

the process zone every local-time presentation uses, as an IANA identifier. The app sets it once from config/environment.rb with Snails.time_zone = "<zone>"; before that line runs, the slot reads as "UTC".

Returns:

  • (String) —

    the IANA identifier ("UTC" when nothing was set)



39
# File 'runtime/snails/time_zone.rb', line 39

def self.time_zone: () -> String

.time_zone=(name) ⇒ void

pin the process zone. The name may be a zone vocabulary name or an IANA identifier; Snails.iana_zone resolves and validates it before the slot changes, and ENV["TZ"] is set for libc.

Examples:

Snails.time_zone = "Seoul"

Parameters:

  • name (String) —

    the zone name or IANA identifier

Raises:

  • (ArgumentError) —

    the name has no zone file



54
# File 'runtime/snails/time_zone.rb', line 54

def self.time_zone=: (String name) -> void

.version ⇒ String

the framework version the running core was packaged from.

Returns:

  • (String) —

    the release tag or revision, "unknown" when unstamped



19
# File 'runtime/snails/version.rb', line 19

def self.version: () -> String