File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
activesupport/lib/active_support Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ def self.parse(content_path, **options)
19
19
end
20
20
21
21
def parse ( context : nil , **options )
22
- source = render ( context )
22
+ source = @content . include? ( "<%" ) ? render ( context ) : @content
23
+
23
24
if source == @content
24
25
if YAML . respond_to? ( :unsafe_load )
25
26
YAML . unsafe_load_file ( @content_path , **options ) || { }
@@ -42,7 +43,6 @@ def parse(context: nil, **options)
42
43
private
43
44
def read ( content_path )
44
45
require "yaml" unless defined? ( YAML )
45
- require "erb" unless defined? ( ERB )
46
46
47
47
File . read ( content_path ) . tap do |content |
48
48
if content . include? ( "\u00A0 " )
@@ -52,6 +52,7 @@ def read(content_path)
52
52
end
53
53
54
54
def render ( context )
55
+ require "erb" unless defined? ( ERB )
55
56
erb = ERB . new ( @content ) . tap { |e | e . filename = @content_path }
56
57
context ? erb . result ( context ) : erb . result
57
58
end
You can’t perform that action at this time.
0 commit comments