Skip to content

Documentation


Documentation / @blazetrails/activesupport / isModuleIncluded

Function: isModuleIncluded() ​

isModuleIncluded(klass, mod): boolean

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

Ruby's Module#< — is mod in klass's ancestry?

ActiveRecord::AttributeMethods::Dirty's included do block asks exactly this (activerecord/lib/active_record/attribute_methods/dirty.rb:44-47, if self < ::ActiveRecord::Timestamp), and there is no other way to ask it here: JavaScript keeps no ancestry record of a mixin, since include() copies a module's members onto the prototype rather than splicing a link for it. The registry include() keeps is that record.

Mirrors: Ruby's Module#include? — vendor/ruby/v3.3.11/class.c:1538 rb_mod_include_p.

Parameters ​

ParameterType
klassobject | { prototype: object; }
modobject | AnyClass | Module<Record<never, never>>

Returns ​

boolean

No Rails Equivalent ​

PERMANENT — Ruby spells this <, an operator TypeScript cannot define; the predicate carries the same question at a callable name.