Skip to content

Commit 72558eb

Browse files
committed
Add docs
1 parent e4229cd commit 72558eb

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

lib/tapioca/dsl/compilers/devise.rb

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,40 @@
11
# typed: true
22
# frozen_string_literal: true
33

4-
require "devise"
4+
return unless defined?(Devise)
55

66
module Tapioca
77
module Dsl
88
module Compilers
9+
# `Tapioca::Dsl::Compilers::Devise` generates RBI files for `ApplicationController``
10+
#
11+
# For example, with the following routes configuration:
12+
#
13+
# ~~~rb
14+
# Rails.application.routes.draw do
15+
# devise_for :users
16+
# end
17+
# ~~~
18+
#
19+
# this compiler will produce the RBI file `user.rbi` with the following content:
20+
#
21+
# ~~~rbi
22+
# # user.rbi
23+
# # typed: true
24+
# class ApplicationController
25+
# sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
26+
# def user_session; end
27+
#
28+
# sig { returns(T::Boolean) }
29+
# def user_signed_in?; end
30+
#
31+
# sig { void }
32+
# def authenticate_user!; end
33+
#
34+
# sig { returns(T.nilable(User)) }
35+
# def current_user; end
36+
# end
37+
# ~~~
938
class Devise < Tapioca::Dsl::Compiler
1039
extend T::Sig
1140

0 commit comments

Comments
 (0)