Sha256: 9a2e784f2d9f9b7d0907ce1ffefb20a2267ecbf2c364c5c536a19ca0d5a7fccb

Contents?: true

Size: 806 Bytes

Versions: 11

Compression:

Stored size: 806 Bytes

Contents

# frozen_string_literal: true

# Include this module into an {HTML} or {SVG} component to make it yield the content block before calling {#template}.
# @example
# 	class Tabs < Phlex::HTML
# 		include DeferredRender
#
# 		Tab = Data.define(:name, :content)
#
# 		def initialize
# 			@tabs = []
# 		end
#
# 		def template
# 			@tabs.each { |t| a { t.name } }
# 			@tabs.each { |t| article(&t.content) }
# 		end
#
# 		def tab(name, &content)
# 			@tabs << Tab.new(name, content)
# 		end
# 	end
module Phlex::DeferredRender
	# This module doesn't do anything. Phlex::HTML#call checks for its inclusion in the ancestry instead.

	# @!method template
	# @abstract Override to define your own template.
	# @note {DeferredRender} templates do not receive the content block. Instead, it is yielded in advance.
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
phlex-1.9.3 lib/phlex/deferred_render.rb
phlex-1.7.2 lib/phlex/deferred_render.rb
phlex-1.8.3 lib/phlex/deferred_render.rb
phlex-1.9.2 lib/phlex/deferred_render.rb
phlex-1.7.1 lib/phlex/deferred_render.rb
phlex-1.8.2 lib/phlex/deferred_render.rb
phlex-1.9.1 lib/phlex/deferred_render.rb
phlex-1.9.0 lib/phlex/deferred_render.rb
phlex-1.8.1 lib/phlex/deferred_render.rb
phlex-1.8.0 lib/phlex/deferred_render.rb
phlex-1.7.0 lib/phlex/deferred_render.rb