Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 707 Bytes

File metadata and controls

32 lines (23 loc) · 707 Bytes

ActiveModelAttributes

Tapioca::Dsl::Compilers::ActiveModelAttributes decorates RBI files for all classes that use ActiveModel::Attributes.

For example, with the following class:

class Shop
  include ActiveModel::Attributes

  attribute :name, :string
end

this compiler will produce an RBI file with the following content:

# typed: true

class Shop
  include GeneratedAttributeMethods

  module GeneratedAttributeMethods
    sig { returns(T.nilable(::String)) }
    def name; end

    sig { params(name: T.nilable(::String)).returns(T.nilable(::String)) }
    def name=(name); end
  end

end