Module: Phlex::Rails::Layout

Defined Under Namespace

Modules: Interface

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HelperMacros

#register_builder_yielding_helper, #register_output_helper, #register_value_helper

Class Method Details

.included(base) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/phlex/rails/layout.rb', line 39

def self.included(base)
	unless base < Phlex::HTML
		raise Phlex::ArgumentError.new("👋 #{name} should only be included into Phlex::HTML classes.")
	end

	base.extend(Interface)
	super
end

Instance Method Details

#identifierObject



63
64
65
# File 'lib/phlex/rails/layout.rb', line 63

def identifier
	self.class.identifier
end

#render(view_context = nil, *args, **kwargs, &block) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/phlex/rails/layout.rb', line 48

def render(view_context = nil, *args, **kwargs, &block)
	if @_state
		super
	else
		render_in(view_context) do |yielded|
			case yielded
			when Symbol
				raw view_context.view_flow.get(yielded)
			else
				yield
			end
		end
	end
end

#virtual_pathObject



67
68
69
# File 'lib/phlex/rails/layout.rb', line 67

def virtual_path
	self.class.virtual_path
end