Sha256: a08c6a0e11f12765faecdf9b730713bf06af2324a682011b3d36d389aee0eb63
Contents?: true
Size: 1.24 KB
Versions: 6
Compression:
Stored size: 1.24 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 module Interface def render(view, _locals, &block) component = new component.call(view_context: view) do |yielded| case yielded when Symbol output = view.view_flow.get(yielded) else output = yield end case output when ActiveSupport::SafeBuffer component.unsafe_raw output end nil end 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, "👋 #{name} should only be included into Phlex::HTML classes." end klass.extend(Interface) end end end
Version data entries
6 entries across 6 versions & 1 rubygems