Skip to content

Documentation


Documentation / @blazetrails/activesupport / DeprecatedConstantProxy

Class: DeprecatedConstantProxy ​

Defined in: packages/activesupport/lib/deprecation/proxy-wrappers.ts:134

Ruby's Module.new — an anonymous module built at runtime and populated after the fact (mod.module_eval { define_method … }), then mixed into a class with include.

Unlike a plain-object module, whose methods include() copies onto the class prototype once, a Module instance is live: include() splices a carrier object into the prototype chain directly below the including class's prototype, and every method the module defines afterwards is found by instances from then on. That is Ruby's actual include semantics — including that a method defined in the class body outranks the module's.

The carrier is a separate object from the module because a JS object cannot be both: everything reachable from a link in an instance's prototype chain is an instance method, whereas Ruby's module object carries its own methods (Module#inspect, #name) outside the ancestry it contributes. So the module's methods are reached through the Ruby-named Module API below, which operates on the carrier.

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

No Rails Equivalent ​

PERMANENT — a Ruby core class, not a Rails one.

Extends ​

Constructors ​

Constructor ​

new DeprecatedConstantProxy(oldConst, newConst, deprecator, __namedParameters?): DeprecatedConstantProxy

Defined in: packages/activesupport/lib/deprecation/proxy-wrappers.ts:140

Parameters ​

ParameterType
oldConststring
newConststring
deprecatorDeprecation
__namedParameters{ message?: string; }
__namedParameters.message?string

Returns ​

DeprecatedConstantProxy

Overrides ​

Module.constructor

Accessors ​

name ​

Get Signature ​

get name(): string

Defined in: packages/activesupport/lib/deprecation/proxy-wrappers.ts:164

Mirrors: Ruby's Module#name — vendor/ruby/v3.3.11/variable.c:122 rb_mod_name: the classpath const_set gave the module, or nil while it is anonymous.

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Returns ​

string

Overrides ​

Module.name

Methods ​

aliasMethod() ​

aliasMethod(newName, oldName): string

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

Mirrors: Ruby's Module#alias_method — vendor/ruby/v3.3.11/vm_method.c:2366 rb_mod_alias_method.

Parameters ​

ParameterType
newNamestring
oldNamestring

Returns ​

string

No Rails Equivalent ​

PERMANENT

Inherited from ​

Module.aliasMethod


ancestors() ​

ancestors(): object[]

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

Mirrors: Ruby's Module#ancestors — vendor/ruby/v3.3.11/class.c:1570 rb_mod_ancestors: the module, then the modules it includes, most recently included first, each followed by its own.

Returns ​

object[]

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.ancestors


appendFeatures() ​

appendFeatures(base): void

Defined in: packages/activesupport/lib/deprecation/proxy-wrappers.ts:181

Mirrors: Ruby's Module#append_features — vendor/ruby/v3.3.11/eval.c:1110 rb_mod_append_features, the splice include runs before included. A Module this module included is spliced beneath it, as include_modules_at (vendor/ruby/v3.3.11/class.c:1253) walks the included module's own ancestry, skipping one already in base's. A Module base is a module including this one: every class already including base gets it too, as rb_include_module walks base's subclasses (vendor/ruby/v3.3.11/class.c:1189-1215).

Parameters ​

ParameterType
base(...args) => any

Returns ​

void

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Overrides ​

Module.appendFeatures


attrReader() ​

attrReader(...argv): void

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

Mirrors: Ruby's Module#attr_reader — vendor/ruby/v3.3.11/object.c:2279 rb_mod_attr_reader.

Parameters ​

ParameterType
...argvstring[]

Returns ​

void

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.attrReader


attrWriter() ​

attrWriter(...argv): void

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

Mirrors: Ruby's Module#attr_writer — vendor/ruby/v3.3.11/object.c:2335 rb_mod_attr_writer.

Parameters ​

ParameterType
...argvstring[]

Returns ​

void

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.attrWriter


class() ​

class(): unknown

Defined in: packages/activesupport/lib/deprecation/proxy-wrappers.ts:177

Returns ​

unknown


defineMethod() ​

defineMethod(name, body): void

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

Mirrors: Ruby's Module#define_method — vendor/ruby/v3.3.11/proc.c:2325 rb_mod_define_method.

Parameters ​

ParameterType
namestring
body(...args) => unknown

Returns ​

void

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.defineMethod


dup() ​

dup(): this

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

Mirrors: Ruby's Module#dup — vendor/ruby/v3.3.11/object.c:591 rb_obj_dup, whose initialize_copy is vendor/ruby/v3.3.11/class.c:524 rb_mod_init_copy: the copy gets its own method table and a clone of the singleton class (rb_singleton_class_clone, :545-548), and shares the modules it includes. Nothing that already includes the original includes the copy.

Returns ​

this

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.dup


extended() ​

extended(base): void

Defined in: packages/activesupport/lib/deprecation/proxy-wrappers.ts:191

Parameters ​

ParameterType
baseobject

Returns ​

void


extendObject() ​

extendObject(obj): void

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

Mirrors: Ruby's Module#extend_object — vendor/ruby/v3.3.11/eval.c:1746 rb_mod_extend_object, which rb_extend_object (:1713) runs as rb_include_module(rb_singleton_class(obj), module): the module's link is spliced between obj and its class, so a later extend sits above it and superMethod resumes the lookup at the next link. A module already in obj's ancestry is skipped, as include_modules_at skips one (vendor/ruby/v3.3.11/class.c:1281,1291,1296). A frozen object's singleton class is frozen, so rb_class_modify_check (vendor/ruby/v3.3.11/eval.c:429) raises FrozenError first.

One link is made per extended object, so singleton links are held through WeakRefs that relinkIncluders still walks, keeping a later defineMethod visible on an already-extended object as Ruby's shared method table does, without retaining the object.

A class's constructor reaches its superclass through the same prototype link (super() reads Object.getPrototypeOf(klass)), so the link spliced above a class is itself a subclass of the class's parent.

Parameters ​

ParameterType
objobject

Returns ​

void

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.extendObject


hash() ​

hash(): unknown

Defined in: packages/activesupport/lib/deprecation/proxy-wrappers.ts:168

Returns ​

unknown


include() ​

include(mod): this

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

Mirrors: Ruby's Module#include into a module — vendor/ruby/v3.3.11/class.c:1179 rb_include_module, which splices mod BELOW this module, so a method this module defines itself outranks the included one. A module already included is skipped (include_modules_at, class.c:1281,1291,1296). A module defining appendFeatures gets that call instead, then included, as rb_mod_include sends both (vendor/ruby/v3.3.11/eval.c:1159-1160). ensure_includable (class.c:1168-1176) rejects a Ruby Class; a TS class passed here is a class module, the spelling include already takes for a Ruby module that carries accessors, so its prototype methods are the module's method table.

A plain-object module's getter and setter are methods too (def title / def title=), so the pair is carried as an accessor, uncalled. An ES module namespace (import * as Helper) is the exception: its exports are functions a bundler may serve through getters, so each is read and installed as the method it names.

Parameters ​

ParameterType
modobject

Returns ​

this

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.include


inspect() ​

inspect(): string

Defined in: packages/activesupport/lib/deprecation/proxy-wrappers.ts:156

Mirrors: Ruby's Module#inspect — vendor/ruby/v3.3.11/object.c:1710 rb_mod_to_s, which renders rb_class_name: the classpath, or the #<Klass:0x…> path make_temporary_path (vendor/ruby/v3.3.11/variable.c:320) gives an anonymous one.

Returns ​

string

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Overrides ​

Module.inspect


instanceMethod() ​

instanceMethod(name): PropertyDescriptor | undefined

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

Mirrors: Ruby's Module#instance_method — the named method, detached from this module. Ruby returns an UnboundMethod, which define_method binds into another module; the TS carrier of that is the property descriptor, which Object.defineProperty re-installs and which — unlike a bare function — also carries an accessor pair.

vendor/ruby/v3.3.11/proc.c:2190 rb_mod_instance_method.

Parameters ​

ParameterType
namestring

Returns ​

PropertyDescriptor | undefined

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.instanceMethod


instanceMethods() ​

instanceMethods(): string[]

Defined in: packages/activesupport/lib/deprecation/proxy-wrappers.ts:160

Mirrors: Ruby's Module#instance_methods — vendor/ruby/v3.3.11/class.c:1889 rb_class_instance_methods, whose include_super defaults to true: the methods of the module's ancestors follow its own, and a name a nearer module undefines stays hidden.

Returns ​

string[]

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Overrides ​

Module.instanceMethods


isInclude() ​

isInclude(mod2): boolean

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

Mirrors: Ruby's Module#include? — vendor/ruby/v3.3.11/class.c:1538 rb_mod_include_p, which walks the module's ancestry, so a module included by an included module answers true.

Parameters ​

ParameterType
mod2object

Returns ​

boolean

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.isInclude


isMethodDefined() ​

isMethodDefined(name): boolean

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

Mirrors: Ruby's Module#method_defined? — vendor/ruby/v3.3.11/vm_method.c:2055 rb_mod_method_defined.

Parameters ​

ParameterType
namestring

Returns ​

boolean

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.isMethodDefined


isRespondTo() ​

isRespondTo(method, includeAll?): boolean

Defined in: packages/activesupport/lib/deprecation/proxy-wrappers.ts:173

Parameters ​

ParameterTypeDefault value
methodstringundefined
includeAllbooleanfalse

Returns ​

boolean


moduleEval() ​

moduleEval<T>(block): T

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

Mirrors: Ruby's Module#module_eval — vendor/ruby/v3.3.11/vm_eval.c:2128 rb_mod_module_eval — yields the module's method table, with the module as this (the block's self), so a block can call this.include(...).

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
block(this, mod) => T

Returns ​

T

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.moduleEval


prependFeatures() ​

prependFeatures(base): void

Defined in: packages/activesupport/lib/deprecation/proxy-wrappers.ts:186

Mirrors: Ruby's Module#prepend_features — vendor/ruby/v3.3.11/eval.c:1175 rb_mod_prepend_features, the splice prepend runs before prepended. rb_prepend_module (vendor/ruby/v3.3.11/class.c:1430) moves the class's method table to an origin iclass (ensure_origin, class.c:1379) and splices the module between the class and that origin, so superMethod resumes at the class's own method. Here the origin holds the class's methods of the names the module defines; a later include is spliced beneath it, as rb_include_module splices at RCLASS_ORIGIN (class.c:1186). The origin is an iclass owned by the class, so rbClassSuperclass skips it and methodOwner answers the class for a method it holds.

Two things MRI does have no JS counterpart. A method assigned to the class after the prepend lands on the class, above the module, where Ruby's def lands in the origin; and a moved method that calls super.name() resumes from the class, its home object, and so re-enters the module. A class whose own property of one of the module's names cannot be moved raises TypeError.

Parameters ​

ParameterType
base(...args) => any

Returns ​

void

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Overrides ​

Module.prependFeatures


removeMethod() ​

removeMethod(...names): this

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

Mirrors: Ruby's Module#remove_method — vendor/ruby/v3.3.11/vm_method.c:1728 rb_mod_remove_method.

Parameters ​

ParameterType
...namesstring[]

Returns ​

this

No Rails Equivalent ​

PERMANENT

Inherited from ​

Module.removeMethod


superMethod() ​

superMethod(receiver, name): ((...args) => unknown) | undefined

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

Mirrors: Ruby's super from one of this module's methods — vendor/ruby/v3.3.11/vm_insnhelper.c:4648 vm_search_super_method, the lookup Method#super_method exposes (vendor/ruby/v3.3.11/proc.c:3391): resume the method search at RCLASS_SUPER of the iclass this module contributed to receiver's ancestry. Answers the next method bound to receiver, or undefined where Ruby's super_method answers nil.

A JS function's super is fixed to its home object, which for a carrier method is the module's own table, not the includer's link, so the link is found on the receiver's prototype chain instead.

Every ancestry ends in Object, which includes Kernel, so a super that no link beneath the caller answers reaches Kernel's method. No JS object stands at that root, so the search ends in the Kernel module's table.

A reader and writer generated as one accessor pair are two Ruby methods, name and name=, so name answers the next getter and name= the next setter, each looked up independently the way Ruby looks each method up.

Parameters ​

ParameterType
receiverobject
namestring

Returns ​

((...args) => unknown) | undefined

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.superMethod


toS() ​

toS(): string

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

Mirrors: Ruby's Module#to_s — vendor/ruby/v3.3.11/object.c:1710 rb_mod_to_s, the method Module#inspect is an alias of (vendor/ruby/v3.3.11/object.c:4438-4439).

Returns ​

string

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.toS


undefMethod() ​

undefMethod(...names): this

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

Mirrors: Ruby's Module#undef_method — vendor/ruby/v3.3.11/vm_method.c:1973 rb_mod_undef_method.

Parameters ​

ParameterType
...namesstring[]

Returns ​

this

No Rails Equivalent ​

PERMANENT — a Ruby core method, not a Rails one.

Inherited from ​

Module.undefMethod