Skip to content

Commit

Permalink
Allow rendering strings (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper authored Nov 24, 2023
1 parent 5a4002f commit ddeb5dc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/phlex/sgml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,16 @@ def render(renderable, &block)
end
when Enumerable
renderable.each { |r| render(r, &block) }
when Proc
when Proc, Method
if renderable.arity == 0
yield_content_with_no_args(&renderable)
else
yield_content(&renderable)
end
when String
plain(renderable)
else
raise ArgumentError, "You can't render a #{renderable}."
raise ArgumentError, "You can't render a #{renderable.inspect}."
end

nil
Expand Down

0 comments on commit ddeb5dc

Please sign in to comment.