Module: RactorRailsShim::FallbackBuilder::ValueLookup::Cvar

Defined in:
lib/ractor_rails_shim/roles/fallback_builder.rb

Overview

@@class_variable — for mattr_accessor: the value may have been written to @@sym after define-time (e.g. by an initializer).

Class Method Summary collapse

Class Method Details

.lookup(owner_name, attr_name, _ies_key, safe_const_get:) ⇒ Object



151
152
153
154
155
156
157
158
# File 'lib/ractor_rails_shim/roles/fallback_builder.rb', line 151

def self.lookup(owner_name, attr_name, _ies_key, safe_const_get:, **)
  return nil unless owner_name && attr_name.is_a?(Symbol)
  owner_mod = safe_const_get.call(owner_name)
  return nil unless owner_mod && owner_mod.class_variable_defined?("@@#{attr_name}")
  owner_mod.class_variable_get("@@#{attr_name}")
rescue StandardError
  nil
end