Sha256: 907a46ce6c752b66b4e1ac485d9bfb0f8511d287409216e49e52d8bedfdb207f
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
require 'hanami/utils/escape' module Hanami module Helpers module HtmlHelper # HTML Fragment # # @since 0.2.6 # @api private # # @see Hanami::Helpers::HtmlHelper::HtmlFragment class HtmlFragment # Initialize a HTML Fragment # # @param blk [Proc,Hanami::Helpers::HtmlHelper::HtmlBuilder,NilClass] the content block # # @return [Hanami::Helpers::HtmlHelper::HtmlFragment] def initialize(&blk) @builder = HtmlBuilder.new @blk = blk end # Resolve and return the output # # @return [String] the output # # @since 0.2.6 # @api private # # @see Hanami::Helpers::HtmlHelper::EmptyHtmlNode#to_s def to_s content.to_s end def content result = @builder.resolve(&@blk) if @builder.nested? @builder.to_s else Utils::Escape.html(result) end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems