aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/template
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-08-06 18:48:35 +0200
committerXavier Noria <fxn@hashref.com>2016-08-06 18:48:35 +0200
commit66a7cfa91045e05f134efc9ac0e226e66161e2e6 (patch)
tree39b8554cfe4e27a30be3eed905bc2afcc26cfe89 /actionview/lib/action_view/template
parentbde6547bb6a8ddf18fb687bf20893d3dc87e0358 (diff)
downloadrails-66a7cfa91045e05f134efc9ac0e226e66161e2e6.tar.gz
rails-66a7cfa91045e05f134efc9ac0e226e66161e2e6.tar.bz2
rails-66a7cfa91045e05f134efc9ac0e226e66161e2e6.zip
applies new string literal convention in actionview/lib
The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
Diffstat (limited to 'actionview/lib/action_view/template')
-rw-r--r--actionview/lib/action_view/template/error.rb8
-rw-r--r--actionview/lib/action_view/template/handlers.rb8
-rw-r--r--actionview/lib/action_view/template/handlers/erb.rb16
-rw-r--r--actionview/lib/action_view/template/html.rb4
-rw-r--r--actionview/lib/action_view/template/resolver.rb6
-rw-r--r--actionview/lib/action_view/template/text.rb4
-rw-r--r--actionview/lib/action_view/template/types.rb2
7 files changed, 24 insertions, 24 deletions
diff --git a/actionview/lib/action_view/template/error.rb b/actionview/lib/action_view/template/error.rb
index 0f1348b032..b95e5236a0 100644
--- a/actionview/lib/action_view/template/error.rb
+++ b/actionview/lib/action_view/template/error.rb
@@ -1,5 +1,5 @@
require "active_support/core_ext/enumerable"
-require 'active_support/core_ext/regexp'
+require "active_support/core_ext/regexp"
module ActionView
# = Action View Errors
@@ -37,9 +37,9 @@ module ActionView
template_type = if partial
"partial"
elsif /layouts/i.match?(path)
- 'layout'
+ "layout"
else
- 'template'
+ "template"
end
if partial && path.present?
@@ -131,7 +131,7 @@ module ActionView
if line_number
"on line ##{line_number} of "
else
- 'in '
+ "in "
end + file_name
end
diff --git a/actionview/lib/action_view/template/handlers.rb b/actionview/lib/action_view/template/handlers.rb
index ad4c353608..f4301f6f07 100644
--- a/actionview/lib/action_view/template/handlers.rb
+++ b/actionview/lib/action_view/template/handlers.rb
@@ -2,10 +2,10 @@ module ActionView #:nodoc:
# = Action View Template Handlers
class Template
module Handlers #:nodoc:
- autoload :Raw, 'action_view/template/handlers/raw'
- autoload :ERB, 'action_view/template/handlers/erb'
- autoload :Html, 'action_view/template/handlers/html'
- autoload :Builder, 'action_view/template/handlers/builder'
+ autoload :Raw, "action_view/template/handlers/raw"
+ autoload :ERB, "action_view/template/handlers/erb"
+ autoload :Html, "action_view/template/handlers/html"
+ autoload :Builder, "action_view/template/handlers/builder"
def self.extended(base)
base.register_default_template_handler :raw, Raw.new
diff --git a/actionview/lib/action_view/template/handlers/erb.rb b/actionview/lib/action_view/template/handlers/erb.rb
index 058b590c56..375153e4fc 100644
--- a/actionview/lib/action_view/template/handlers/erb.rb
+++ b/actionview/lib/action_view/template/handlers/erb.rb
@@ -1,5 +1,5 @@
-require 'erubis'
-require 'active_support/core_ext/regexp'
+require "erubis"
+require "active_support/core_ext/regexp"
module ActionView
class Template
@@ -29,7 +29,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 +41,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 +63,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 +78,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 +109,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)
diff --git a/actionview/lib/action_view/template/html.rb b/actionview/lib/action_view/template/html.rb
index 0321f819b5..ddbd2ea36a 100644
--- a/actionview/lib/action_view/template/html.rb
+++ b/actionview/lib/action_view/template/html.rb
@@ -11,11 +11,11 @@ module ActionView #:nodoc:
end
def identifier
- 'html template'
+ "html template"
end
def inspect
- 'html template'
+ "html template"
end
def to_str
diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb
index bf68e93c58..aa107f9923 100644
--- a/actionview/lib/action_view/template/resolver.rb
+++ b/actionview/lib/action_view/template/resolver.rb
@@ -252,7 +252,7 @@ module ActionView
def inside_path?(path, filename)
filename = File.expand_path(filename)
- path = File.join(path, '')
+ path = File.join(path, "")
filename.start_with?(path)
end
@@ -260,7 +260,7 @@ module ActionView
def build_query(path, details)
query = @pattern.dup
- prefix = path.prefix.empty? ? '' : "#{escape_entry(path.prefix)}\\1"
+ prefix = path.prefix.empty? ? "" : "#{escape_entry(path.prefix)}\\1"
query.gsub!(/:prefix(\/)?/, prefix)
partial = escape_entry(path.partial? ? "_#{path.name}" : path.name)
@@ -290,7 +290,7 @@ module ActionView
# from the path, or the handler, we should return the array of formats given
# to the resolver.
def extract_handler_and_format_and_variant(path, default_formats)
- pieces = File.basename(path).split('.'.freeze)
+ pieces = File.basename(path).split(".".freeze)
pieces.shift
extension = pieces.pop
diff --git a/actionview/lib/action_view/template/text.rb b/actionview/lib/action_view/template/text.rb
index 04f5b8d17a..898593e702 100644
--- a/actionview/lib/action_view/template/text.rb
+++ b/actionview/lib/action_view/template/text.rb
@@ -11,11 +11,11 @@ module ActionView #:nodoc:
end
def identifier
- 'text template'
+ "text template"
end
def inspect
- 'text template'
+ "text template"
end
def to_str
diff --git a/actionview/lib/action_view/template/types.rb b/actionview/lib/action_view/template/types.rb
index b32567cd66..21959a3798 100644
--- a/actionview/lib/action_view/template/types.rb
+++ b/actionview/lib/action_view/template/types.rb
@@ -1,4 +1,4 @@
-require 'active_support/core_ext/module/attribute_accessors'
+require "active_support/core_ext/module/attribute_accessors"
module ActionView
class Template