mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Expand key word args for ActionView::Template
This commit is contained in:
parent
9a343d148b
commit
3a8d5dac9a
2 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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 = {})
|
||||
|
|
Loading…
Reference in a new issue