sorbet_erb 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/examples/config.yml +4 -0
- data/lib/sorbet_erb/version.rb +1 -1
- data/lib/sorbet_erb.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4d7642a1bb849cc57c7376e3d9915c7821c3923257e1c1ab3c1a1215906c57a5
|
|
4
|
+
data.tar.gz: badb1675c3ff1350a3f4fe597ed2937e6d8216226cf2b178cf49bdedcc6818c5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8377db6a336f7f8bb534015c314dfe08930b9172a6053e7bd6f84150f340649ff7fff981ef8d0bf0c715929e0aa554ab2dad775132e56fbc925121c1566cf982
|
|
7
|
+
data.tar.gz: 88467a1b8075722bd6fc336a4f1eb0300f74f06d7bee309f6ec27393eb91a7dc6c5d258bd302a54882f206216314af58f2229aaa0b06e4a1d535126d71f44dba
|
data/examples/config.yml
CHANGED
|
@@ -11,6 +11,10 @@ exclude_paths:
|
|
|
11
11
|
# `output_dir` is the directory generated RBI files will be written to
|
|
12
12
|
output_dir: 'sorbet/erb'
|
|
13
13
|
|
|
14
|
+
# `app_controller_class` configures the base Rails controller class.
|
|
15
|
+
# Defaults to ApplicationController
|
|
16
|
+
app_controller_class: 'ApplicationController'
|
|
17
|
+
|
|
14
18
|
# `extra_includes` are Ruby constants that will be included into the generated
|
|
15
19
|
# RBI. This is necessary since sorbet_erb does not walk the dependency graph, so
|
|
16
20
|
# some gems that are available to views are not automatically included.
|
data/lib/sorbet_erb/version.rb
CHANGED
data/lib/sorbet_erb.rb
CHANGED
|
@@ -19,6 +19,7 @@ module SorbetErb
|
|
|
19
19
|
const :input_dirs, T::Array[String], default: ['app']
|
|
20
20
|
const :exclude_paths, T::Array[String], default: []
|
|
21
21
|
const :output_dir, String, default: 'sorbet/erb'
|
|
22
|
+
const :app_controller_class, String, default: 'ApplicationController'
|
|
22
23
|
const :extra_includes, T::Array[String], default: []
|
|
23
24
|
const :extra_body, String, default: ''
|
|
24
25
|
const :skip_missing_locals, T::Boolean, default: true
|
|
@@ -32,7 +33,7 @@ module SorbetErb
|
|
|
32
33
|
|
|
33
34
|
ERB_TEMPLATE = <<~ERB_TEMPLATE
|
|
34
35
|
# typed: true
|
|
35
|
-
class <%= class_name %><%=
|
|
36
|
+
class <%= class_name %><%= class_decl_suffix %>
|
|
36
37
|
extend T::Sig
|
|
37
38
|
include ActionView::Helpers
|
|
38
39
|
include ApplicationController::HelperMethods
|
|
@@ -113,7 +114,7 @@ module SorbetErb
|
|
|
113
114
|
File.open(output_path, 'w') do |f|
|
|
114
115
|
result = erb.result_with_hash(
|
|
115
116
|
class_name: class_name,
|
|
116
|
-
extend_app_controller:
|
|
117
|
+
class_decl_suffix: extend_app_controller ? " < #{config.app_controller_class}" : '',
|
|
117
118
|
locals: locals,
|
|
118
119
|
locals_sig: locals_sig,
|
|
119
120
|
extra_includes: config.extra_includes,
|