class Tapioca::Dsl::Compilers::FrozenRecord

~~~
end
end
def last_name?; end
sig { returns(T::Boolean) }
def last_name; end
sig { returns(T.untyped) }
def id?; end
sig { returns(T::Boolean) }
def id; end
sig { returns(T.untyped) }
def first_name?; end
sig { returns(T::Boolean) }
def first_name; end
sig { returns(T.untyped) }
module FrozenRecordAttributeMethods
include FrozenRecordAttributeMethods
class Student
# typed: strong
# Student.rbi
~~~rbi
this compiler will produce the RBI file ‘student.rbi` with the following content:
~~~
last_name: Lord
first_name: Dan
- id: 2
last_name: Smith
first_name: John
- id: 1
# students.yml
~~~ yaml
and the following YAML file:
~~~
end
class Student < FrozenRecord::Base
# student.rb
~~~rb
For example, with the following FrozenRecord class:<br><br>(github.com/byroot/frozen_record).
`Tapioca::Dsl::Compilers::FrozenRecord` generates RBI files for subclasses of

def decorate

def decorate
  attributes = constant.attributes
  return if attributes.empty?
  root.create_path(constant) do |record|
    module_name = "FrozenRecordAttributeMethods"
    record.create_module(module_name) do |mod|
      attributes.each do |attribute|
        mod.create_method("#{attribute}?", return_type: "T::Boolean")
        mod.create_method(attribute.to_s, return_type: "T.untyped")
      end
    end
    record.create_include(module_name)
    decorate_scopes(record)
  end
end

def decorate_scopes(record)

def decorate_scopes(record)
  scopes = constant.__tapioca_scope_names
  return if scopes.nil?
  module_name = "GeneratedRelationMethods"
  record.create_module(module_name) do |mod|
    scopes.each do |name|
      generate_scope_method(name.to_s, mod)
    end
  end
  record.create_extend(module_name)
end

def gather_constants

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

def generate_scope_method(scope_method, mod)

def generate_scope_method(scope_method, mod)
  mod.create_method(
    scope_method,
    parameters: [
      create_rest_param("args", type: "T.untyped"),
      create_block_param("blk", type: "T.untyped"),
    ],
    return_type: "T.untyped",
  )
end