Skip to content

Commit

Permalink
Do not check HamlTemplate inside haml engine check
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Dec 13, 2019
1 parent 78d48cd commit 58e1be0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sinatra-contrib/lib/sinatra/capture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module Capture

def capture(*args, &block)
return block[*args] if ruby?
if haml?
if haml? && Tilt[:haml] == Tilt::HamlTemplate
buffer = Haml::Buffer.new(nil, Haml::Options.new.for_buffer)
with_haml_buffer(buffer) { capture_haml(*args, &block) }
else
Expand Down
2 changes: 1 addition & 1 deletion sinatra-contrib/lib/sinatra/content_for.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def clear_content_for(key)
# for <tt>:head</tt>.
def yield_content(key, *args, &block)
if block_given? && !content_for?(key)
haml? ? capture_haml(*args, &block) : yield(*args)
(haml? && Tilt[:haml] == Tilt::HamlTemplate) ? capture_haml(*args, &block) : yield(*args)
else
content = content_blocks[key.to_sym].map { |b| capture(*args, &b) }
content.join.tap do |c|
Expand Down
5 changes: 2 additions & 3 deletions sinatra-contrib/lib/sinatra/engine_tracking.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ def erubis?
erb? && Tilt[:erb] == Tilt::ErubisTemplate
end

# @return [Boolean] Returns true if current engine is `:haml` and
# `Tilt[:haml]` is set to `Tilt::HamlTemplate`.
# @return [Boolean] Returns true if current engine is `:haml`.
def haml?
@current_engine == :haml && Tilt[:haml] == Tilt::HamlTemplate
@current_engine == :haml
end

# @return [Boolean] Returns true if current engine is `:sass`.
Expand Down

0 comments on commit 58e1be0

Please sign in to comment.