aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/template/text.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2019-02-25 13:18:44 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2019-02-25 13:18:44 -0800
commitca5e23ed4d8818d81314953aadd422b2cbde63b0 (patch)
treea411836c47d0ac22af072ec580656e983954d131 /actionview/lib/action_view/template/text.rb
parentd1f68b50487ea1a8fc7f822973e2cc46d1288060 (diff)
downloadrails-ca5e23ed4d8818d81314953aadd422b2cbde63b0.tar.gz
rails-ca5e23ed4d8818d81314953aadd422b2cbde63b0.tar.bz2
rails-ca5e23ed4d8818d81314953aadd422b2cbde63b0.zip
Templates have one format
Templates only have one format. Before this commit, templates would be constructed with a single element array that contained the format. This commit eliminates the single element array and just implements a `format` method. This saves one array allocation per template.
Diffstat (limited to 'actionview/lib/action_view/template/text.rb')
-rw-r--r--actionview/lib/action_view/template/text.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/actionview/lib/action_view/template/text.rb b/actionview/lib/action_view/template/text.rb
index f8d6c2811f..c5fd55f1b3 100644
--- a/actionview/lib/action_view/template/text.rb
+++ b/actionview/lib/action_view/template/text.rb
@@ -8,7 +8,6 @@ module ActionView #:nodoc:
def initialize(string)
@string = string.to_s
- @type = Types[:text]
end
def identifier
@@ -25,9 +24,12 @@ module ActionView #:nodoc:
to_str
end
- def formats
- [@type.ref]
+ def format
+ :text
end
+
+ def formats; Array(format); end
+ deprecate :formats
end
end
end