Sha256: 46bbbeb56d2a6d201fba0da9c37b7adb7b6848f2e93054478f1a6a27956cd0d4

Contents?: true

Size: 811 Bytes

Versions: 7

Compression:

Stored size: 811 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 view_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

7 entries across 7 versions & 1 rubygems

Version Path
phlex-2.0.0.beta2 lib/phlex/deferred_render.rb
phlex-2.0.0.beta1 lib/phlex/deferred_render.rb
phlex-1.11.0 lib/phlex/deferred_render.rb
phlex-1.10.3 lib/phlex/deferred_render.rb
phlex-1.10.2 lib/phlex/deferred_render.rb
phlex-1.10.1 lib/phlex/deferred_render.rb
phlex-1.10.0 lib/phlex/deferred_render.rb