Sha256: 07fd7de04aae339b7465989655829c05ee6021c4a0c57608f365db716b7f0a7d
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
# frozen_string_literal: true module Phlex::Rails module Layout include Helpers::CSPMetaTag include Helpers::CSRFMetaTags include Helpers::FaviconLinkTag include Helpers::PreloadLinkTag include Helpers::StylesheetLinkTag include Helpers::ActionCableMetaTag include Helpers::AutoDiscoveryLinkTag include Helpers::JavascriptIncludeTag include Helpers::JavascriptImportmapTags include Helpers::JavascriptImportModuleTag include Helpers::TurboRefreshMethodTag include Helpers::TurboRefreshScrollTag include Helpers::TurboRefreshesWith # @api private module Interface def render(view_context, _locals, &) new.render(view_context, &) end def identifier name end def virtual_path return @virtual_path if defined? @virtual_path @virtual_path = name&.dup.tap do |n| n.gsub!("::", ".") n.gsub!(/([a-z])([A-Z])/, '\1_\2') n.downcase! end end end def self.included(klass) unless klass < Phlex::HTML raise Phlex::ArgumentError.new("👋 #{name} should only be included into Phlex::HTML classes.") end klass.extend(Interface) end def render(view_context = nil, *args, **kwargs, &block) if @_context super else call(view_context:) do |yielded| case yielded when Symbol output = view_context.view_flow.get(yielded) else output = view_context.capture(&block) end raw output end end end def identifier self.class.identifier end def virtual_path self.class.virtual_path end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
phlex-rails-2.0.0.beta2 | lib/phlex/rails/layout.rb |
phlex-rails-2.0.0.beta1 | lib/phlex/rails/layout.rb |