Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 974 Bytes

compiler_actiontext.md

File metadata and controls

39 lines (28 loc) · 974 Bytes

ActionText

Tapioca::Dsl::Compilers::ActionText decorates RBI files for subclasses of ActiveRecord::Base that declare has_rich_text

For example, with the following ActiveRecord::Base subclass:

class Post < ApplicationRecord
 has_rich_text :body
 has_rich_text :title, encrypted: true
end

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

# typed: strong

class Post
 sig { returns(ActionText::RichText) }
 def body; end

 sig { params(value: T.nilable(T.any(ActionText::RichText, String))).returns(T.untyped) }
 def body=(value); end

 sig { returns(T::Boolean) }
 def body?; end

 sig { returns(ActionText::EncryptedRichText) }
 def title; end

 sig { params(value: T.nilable(T.any(ActionText::EncryptedRichText, String))).returns(T.untyped) }
 def title=(value); end

 sig { returns(T::Boolean) }
 def title?; end
end