class Phlex::SGML

def render(renderable, &block)

Parameters:
  • enumerable (Enumerable) --
  • proc (Proc) --
  • component_class (Class) --
  • component (Phlex::SGML) --

Overloads:
  • render(enumerable)
  • render(proc)
  • render(component_class, &block)
  • render(component, &block)

Returns:
  • (nil) -
def render(renderable, &block)
	case renderable
	when Phlex::SGML
		renderable.call(@_buffer, context: @_context, view_context: @_view_context, parent: self, &block)
	when Class
		if renderable < Phlex::SGML
			renderable.new.call(@_buffer, context: @_context, view_context: @_view_context, parent: self, &block)
		end
	when Enumerable
		renderable.each { |r| render(r, &block) }
	when Proc
		if renderable.arity == 0
			yield_content_with_no_args(&renderable)
		else
			yield_content(&renderable)
		end
	else
		raise ArgumentError, "You can't render a #{renderable}."
	end
	nil
end