class Tapioca::Dsl::Compilers::ActiveRecordStore

~~~
end
end
def theme_was; end
sig { returns(T.untyped) }
def theme_changed?; end
sig { returns(T::Boolean) }
def theme_change; end
sig { returns(T.untyped) }
def theme_before_last_save; end
sig { returns(T.untyped) }
def theme=(value); end
sig { params(value: T.untyped).returns(T.untyped) }
def theme; end
sig { returns(T.untyped) }
def saved_change_to_theme?; end
sig { returns(T::Boolean) }
def saved_change_to_theme; end
sig { returns(T.untyped) }
def saved_change_to_prefs_power_source?; end
sig { returns(T::Boolean) }
def saved_change_to_prefs_power_source; end
sig { returns(T.untyped) }
def prefs_power_source_was; end
sig { returns(T.untyped) }
def prefs_power_source_changed?; end
sig { returns(T::Boolean) }
def prefs_power_source_change; end
sig { returns(T.untyped) }
def prefs_power_source_before_last_save; end
sig { returns(T.untyped) }
def prefs_power_source=(value); end
sig { params(value: T.untyped).returns(T.untyped) }
def prefs_power_source; end
sig { returns(T.untyped) }
module GeneratedStoredAttributesMethods
include GeneratedStoredAttributesMethods
class User
# typed: true
~~~rbi
this compiler will produce an RBI file with the following content:
~~~
end
store_accessor :settings, :power_source, prefix: :prefs
store :settings, accessors: :theme
class User < ActiveRecord::Base
~~~rb
For example, with the following class:
classes that use [‘ActiveRecord::Store`](api.rubyonrails.org/classes/ActiveRecord/Store.html).
`Tapioca::Dsl::Compilers::ActiveRecordStore` decorates RBI files for all

def decorate

def decorate
  return if constant.__tapioca_stored_attributes.nil?
  root.create_path(constant) do |klass|
    klass.create_module(StoredAttributesModuleName) do |mod|
      constant.__tapioca_stored_attributes.each do |store_attribute, keys, prefix, suffix|
        accessor_prefix =
          case prefix
          when String, Symbol
            "#{prefix}_"
          when TrueClass
            "#{store_attribute}_"
          else
            ""
          end
        accessor_suffix =
          case suffix
          when String, Symbol
            "_#{suffix}"
          when TrueClass
            "_#{store_attribute}"
          else
            ""
          end
        keys.flatten.map { |key| "#{accessor_prefix}#{key}#{accessor_suffix}" }.each do |accessor_key|
          mod.create_method(
            "#{accessor_key}=",
            parameters: [create_param("value", type: "T.untyped")],
            return_type: "T.untyped",
          )
          mod.create_method(accessor_key, return_type: "T.untyped")
          mod.create_method("#{accessor_key}_changed?", return_type: "T::Boolean")
          mod.create_method("#{accessor_key}_change", return_type: "T.untyped")
          mod.create_method("#{accessor_key}_was", return_type: "T.untyped")
          mod.create_method("saved_change_to_#{accessor_key}?", return_type: "T::Boolean")
          mod.create_method("saved_change_to_#{accessor_key}", return_type: "T.untyped")
          mod.create_method("#{accessor_key}_before_last_save", return_type: "T.untyped")
        end
      end
    end
    klass.create_include(StoredAttributesModuleName)
  end
end

def gather_constants

def gather_constants
  descendants_of(::ActiveRecord::Base).reject(&:abstract_class?)
end