Skip to content

Documentation


Documentation / @blazetrails/activesupport / defineModule

Function: defineModule() ​

defineModule<Pub, Prot, Priv>(publicSection, protectedSection?, privateSection?): Pub & Prot & Priv

Defined in: packages/ruby-compat/dist/include.d.ts:535

Compose a module from its visibility sections, the way a Ruby module body separates them with statement-position private / protected keywords.

Returns the flat composition in section order — public, then protected, then private — so include() and Included<typeof ...> consumers see exactly the object a hand-written spread produced. The section membership is additionally stamped under moduleVisibility for publicInstanceMethods to read.

The sections must be pairwise disjoint. A name in two sections is silently won by the last spread, which aliases like buildHavingClause: buildWhereClause (query_methods.rb:1654) make plausible, so it is asserted rather than trusted.

Mirrors: Ruby's Module.new body — vendor/ruby/v3.3.11/object.c:1950 rb_mod_initialize.

Type Parameters ​

Type ParameterDefault type
Pub extends object-
Prot extends objectRecord<never, never>
Priv extends objectRecord<never, never>

Parameters ​

ParameterType
publicSectionPub
protectedSection?Prot
privateSection?Priv

Returns ​

Pub & Prot & Priv

No Rails Equivalent ​

PERMANENT — Ruby declares member visibility with statement-position private / protected inside the module body; a TS object literal has no statement position, so the sections must be named values and composed explicitly.