File tree Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -304,21 +304,11 @@ def template(name, write_to: nil)
304
304
private
305
305
306
306
def read_template ( filepath )
307
- previous_verbosity = $VERBOSE
308
- previous_default_external = Encoding . default_external
309
- $VERBOSE = nil
310
-
311
- begin
312
- Encoding . default_external = Encoding ::UTF_8
313
-
314
- if ERB . instance_method ( :initialize ) . parameters . assoc ( :key ) # Ruby 2.6+
315
- ERB . new ( File . read ( filepath ) , trim_mode : "-" )
316
- else
317
- ERB . new ( File . read ( filepath ) , nil , "-" )
318
- end
319
- ensure
320
- Encoding . default_external = previous_default_external
321
- $VERBOSE = previous_verbosity
307
+ template = File . read ( filepath , encoding : Encoding ::UTF_8 )
308
+ if ERB . instance_method ( :initialize ) . parameters . assoc ( :key ) # Ruby 2.6+
309
+ ERB . new ( template , trim_mode : "-" )
310
+ else
311
+ ERB . new ( template , nil , "-" )
322
312
end
323
313
end
324
314
You can’t perform that action at this time.
0 commit comments