diff options
Diffstat (limited to 'actionview/lib/action_view/template/handlers/erb.rb')
-rw-r--r-- | actionview/lib/action_view/template/handlers/erb.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/actionview/lib/action_view/template/handlers/erb.rb b/actionview/lib/action_view/template/handlers/erb.rb index 058b590c56..5d047a6991 100644 --- a/actionview/lib/action_view/template/handlers/erb.rb +++ b/actionview/lib/action_view/template/handlers/erb.rb @@ -1,5 +1,4 @@ -require 'erubis' -require 'active_support/core_ext/regexp' +require "erubis" module ActionView class Template @@ -29,7 +28,7 @@ module ActionView # We override to always treat <%== as escaped. def add_expr(src, code, indicator) case indicator - when '==' + when "==" add_expr_escaped(src, code) else super @@ -41,9 +40,9 @@ module ActionView def add_expr_literal(src, code) flush_newline_if_pending(src) if BLOCK_EXPR.match?(code) - src << '@output_buffer.append= ' << code + src << "@output_buffer.append= " << code else - src << '@output_buffer.append=(' << code << ');' + src << "@output_buffer.append=(" << code << ");" end end @@ -63,7 +62,7 @@ module ActionView def add_postamble(src) flush_newline_if_pending(src) - src << '@output_buffer.to_s' + src << "@output_buffer.to_s" end def flush_newline_if_pending(src) @@ -78,7 +77,7 @@ module ActionView # Specify trim mode for the ERB compiler. Defaults to '-'. # See ERB documentation for suitable values. class_attribute :erb_trim_mode - self.erb_trim_mode = '-' + self.erb_trim_mode = "-" # Default implementation used. class_attribute :erb_implementation @@ -109,7 +108,7 @@ module ActionView # expression template_source = template.source.dup.force_encoding(Encoding::ASCII_8BIT) - erb = template_source.gsub(ENCODING_TAG, '') + erb = template_source.gsub(ENCODING_TAG, "") encoding = $2 erb.force_encoding valid_encoding(template.source.dup, encoding) @@ -119,8 +118,8 @@ module ActionView self.class.erb_implementation.new( erb, - :escape => (self.class.escape_whitelist.include? template.type), - :trim => (self.class.erb_trim_mode == "-") + escape: (self.class.escape_whitelist.include? template.type), + trim: (self.class.erb_trim_mode == "-") ).src end |