aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/application/dummy_erb_compiler.rb
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2019-03-06 13:02:48 -0500
committerGitHub <noreply@github.com>2019-03-06 13:02:48 -0500
commita2bc42f1e78fbc48f7810abf5970268ccefaf021 (patch)
treee4f10993ef691b4be4ec6f8908132423a6577ef2 /railties/lib/rails/application/dummy_erb_compiler.rb
parent1818c4e8b49d053ca7a220288dd6823984bc0328 (diff)
parent37d1429ab1da78a3b8afcfcec8a135ac85cd897a (diff)
downloadrails-a2bc42f1e78fbc48f7810abf5970268ccefaf021.tar.gz
rails-a2bc42f1e78fbc48f7810abf5970268ccefaf021.tar.bz2
rails-a2bc42f1e78fbc48f7810abf5970268ccefaf021.zip
Merge pull request #35497 from eileencodes/parse-yaml-without-erb-for-rake-tasks
Load YAML for rake tasks without parsing ERB
Diffstat (limited to 'railties/lib/rails/application/dummy_erb_compiler.rb')
-rw-r--r--railties/lib/rails/application/dummy_erb_compiler.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/railties/lib/rails/application/dummy_erb_compiler.rb b/railties/lib/rails/application/dummy_erb_compiler.rb
new file mode 100644
index 0000000000..4e92526969
--- /dev/null
+++ b/railties/lib/rails/application/dummy_erb_compiler.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+# These classes are used to strip out the ERB configuration
+# values so we can evaluate the database.yml without evaluating
+# the ERB values.
+class DummyERB < ERB # :nodoc:
+ def make_compiler(trim_mode)
+ DummyCompiler.new trim_mode
+ end
+end
+
+class DummyCompiler < ERB::Compiler # :nodoc:
+ def compile_content(stag, out)
+ out.push "_erbout << 'dummy_compiler'"
+ end
+end