aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2019-02-25 16:39:13 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2019-02-25 16:39:13 -0800
commit3a8d5dac9aa82d9d775c04d70230a2e0b404e162 (patch)
tree227c4f23fb478c27f0949f40c5de73d25c8aa00a /actionview
parent9a343d148b96874a231b87906c9d6499b5e0b64a (diff)
downloadrails-3a8d5dac9aa82d9d775c04d70230a2e0b404e162.tar.gz
rails-3a8d5dac9aa82d9d775c04d70230a2e0b404e162.tar.bz2
rails-3a8d5dac9aa82d9d775c04d70230a2e0b404e162.zip
Expand key word args for ActionView::Template
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/template.rb6
-rw-r--r--actionview/test/template/template_test.rb2
2 files changed, 4 insertions, 4 deletions
diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb
index 09476ceadc..06d3de17b3 100644
--- a/actionview/lib/action_view/template.rb
+++ b/actionview/lib/action_view/template.rb
@@ -125,7 +125,7 @@ module ActionView
attr_reader :source, :identifier, :handler, :original_encoding, :updated_at
attr_reader :variable, :format, :variant, :locals, :virtual_path
- def initialize(source, identifier, handler, format: nil, variant: nil, locals: nil, **details)
+ def initialize(source, identifier, handler, format: nil, variant: nil, locals: nil, virtual_path: nil, updated_at: Time.now)
unless format
ActiveSupport::Deprecation.warn "ActionView::Template#initialize requires a format parameter"
format = :html
@@ -142,7 +142,7 @@ module ActionView
@compiled = false
@original_encoding = nil
@locals = locals
- @virtual_path = details[:virtual_path]
+ @virtual_path = virtual_path
@variable = if @virtual_path
base = @virtual_path[-1] == "/" ? "" : File.basename(@virtual_path)
@@ -150,7 +150,7 @@ module ActionView
$1.to_sym
end
- @updated_at = details[:updated_at] || Time.now
+ @updated_at = updated_at
@format = format
@variant = variant
@compile_mutex = Mutex.new
diff --git a/actionview/test/template/template_test.rb b/actionview/test/template/template_test.rb
index 5a24aea173..71fb99115b 100644
--- a/actionview/test/template/template_test.rb
+++ b/actionview/test/template/template_test.rb
@@ -59,7 +59,7 @@ class TestERBTemplate < ActiveSupport::TestCase
def new_template(body = "<%= hello %>", details = {})
details = { format: :html, locals: [] }.merge details
- ActionView::Template.new(body.dup, "hello template", details.fetch(:handler) { ERBHandler }, { virtual_path: "hello" }.merge!(details))
+ ActionView::Template.new(body.dup, "hello template", details.delete(:handler) || ERBHandler, { virtual_path: "hello" }.merge!(details))
end
def render(locals = {})