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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f0ffb3f2a903201a4ff7474204a33e400563a3d14faa0eb7b8aa4f3af10e1f1
4
- data.tar.gz: 52b6690f377808547ab8248e00b4567f30c21e3bb021dd137df9c51b559aebf9
3
+ metadata.gz: 4d7642a1bb849cc57c7376e3d9915c7821c3923257e1c1ab3c1a1215906c57a5
4
+ data.tar.gz: badb1675c3ff1350a3f4fe597ed2937e6d8216226cf2b178cf49bdedcc6818c5
5
5
  SHA512:
6
- metadata.gz: 38cd57f70ed57d3b2672bd779aedaeb2b97d410f91505a85360cbcfbafa63b889de3042eda820ea0b82909c4c30d9a1d0d4a3a6da2881233d83342b3fabc8243
7
- data.tar.gz: a036613a05524d17d925146b638b0dafd5eb9c39ec4288daee96ad002da360786ed58cef778088aa78bfb97a8ae5ce2fae2d0e1c39e826813579f4584c964aff
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.
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module SorbetErb
5
- VERSION = '0.6.0'
5
+ VERSION = '0.7.0'
6
6
  end
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 %><%= extend_app_controller ? " < ApplicationController" : "" %>
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: 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,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorbet_erb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franklin Hu