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 Parameter | Default type |
|---|---|
Pub extends object | - |
Prot extends object | Record<never, never> |
Priv extends object | Record<never, never> |
Parameters
| Parameter | Type |
|---|---|
publicSection | Pub |
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.