Skip to content

Commit

Permalink
Update method to compile block templates
Browse files Browse the repository at this point in the history
  • Loading branch information
jkowens committed Oct 4, 2021
1 parent ac1c251 commit b3a85e1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/sinatra/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -903,9 +903,10 @@ def compile_template(engine, data, options, views)
end

def compile_block_template(template, options, &body)
caller = settings.caller_locations.first
path = options[:path] || caller[0]
line = options[:line] || caller[1]
first_location = caller_locations.first
path, line = first_location.path, first_location.lineno
path = options[:path] || path
line = options[:line] || line
template.new(path, line.to_i, options, &body)
end
end
Expand Down

0 comments on commit b3a85e1

Please sign in to comment.