Skip to content

Commit

Permalink
Make yield_content private (#798)
Browse files Browse the repository at this point in the history
You can pass a block to `render` instead.
  • Loading branch information
joeldrapper authored Oct 3, 2024
1 parent 9763888 commit fe60f93
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/phlex/sgml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def call(buffer = +"", context: Phlex::Context.new, view_context: nil, parent: n
if args.length > 0
__yield_content_with_args__(*args, &block)
else
yield_content(&block)
__yield_content__(&block)
end
end
end
Expand Down Expand Up @@ -139,7 +139,7 @@ def whitespace(&)
buffer << " "

if block_given?
yield_content(&)
__yield_content__(&)
buffer << " "
end

Expand All @@ -153,7 +153,7 @@ def comment(&)
buffer = context.buffer

buffer << "<!-- "
yield_content(&)
__yield_content__(&)
buffer << " -->"

nil
Expand All @@ -180,7 +180,7 @@ def capture(*args, &block)
if args.length > 0
@_context.capturing_into(+"") { __yield_content_with_args__(*args, &block) }
else
@_context.capturing_into(+"") { yield_content(&block) }
@_context.capturing_into(+"") { __yield_content__(&block) }
end
end

Expand Down Expand Up @@ -217,12 +217,12 @@ def render(renderable = nil, &)
if renderable.arity == 0
__yield_content_with_no_args__(&renderable)
else
yield_content(&renderable)
__yield_content__(&renderable)
end
when String
plain(renderable)
when nil
yield_content(&) if block_given?
__yield_content__(&) if block_given?
else
raise Phlex::ArgumentError.new("You can't render a #{renderable.inspect}.")
end
Expand Down Expand Up @@ -267,7 +267,7 @@ def after_template
nil
end

def yield_content
def __yield_content__
return unless block_given?

buffer = @_context.buffer
Expand Down

0 comments on commit fe60f93

Please sign in to comment.