Skip to content

Latest commit

 

History

History
49 lines (36 loc) · 1.01 KB

compiler_activesupportcurrentattributes.md

File metadata and controls

49 lines (36 loc) · 1.01 KB

ActiveSupportCurrentAttributes

Tapioca::Dsl::Compilers::ActiveSupportCurrentAttributes decorates RBI files for all subclasses of ActiveSupport::CurrentAttributes.

For example, with the following singleton class

class Current < ActiveSupport::CurrentAttributes
  extend T::Sig

  attribute :account

  def helper
    # ...
  end

  sig { params(user_id: Integer).void }
  def authenticate(user_id)
    # ...
  end
end

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

# typed: true

class Current
  sig { returns(T.untyped) }
  def self.account; end

  sig { returns(T.untyped) }
  def account; end

  sig { params(account: T.untyped).returns(T.untyped) }
  def self.account=(account); end

  sig { params(account: T.untyped).returns(T.untyped) }
  def account=(account); end

  sig { params(user_id: Integer).void }
  def self.authenticate(user_id); end

  sig { returns(T.untyped) }
  def self.helper; end
end