Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 729 Bytes

compiler_mixedinclassattributes.md

File metadata and controls

40 lines (30 loc) · 729 Bytes

MixedInClassAttributes

Tapioca::Dsl::Compilers::MixedInClassAttributes generates RBI files for modules that dynamically use class_attribute on classes.

For example, given the following concern

module Taggeable
  extend ActiveSupport::Concern

  included do
    class_attribute :tag
  end
end

this compiler will produce the RBI file taggeable.rbi with the following content:

# typed: strong

module Taggeable
  include GeneratedInstanceMethods

  mixes_in_class_methods GeneratedClassMethods

  module GeneratedClassMethods
    def tag; end
    def tag=(value); end
    def tag?; end
  end

  module GeneratedInstanceMethods
    def tag; end
    def tag=(value); end
    def tag?; end
  end
end