From 3a8d5dac9aa82d9d775c04d70230a2e0b404e162 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 25 Feb 2019 16:39:13 -0800 Subject: [PATCH] Expand key word args for ActionView::Template --- actionview/lib/action_view/template.rb | 6 +++--- actionview/test/template/template_test.rb | 2 +- 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 = {})