Class: Hanami::Helpers::HtmlHelper::HtmlFragment Private
- Inherits:
-
Object
- Object
- Hanami::Helpers::HtmlHelper::HtmlFragment
- Defined in:
- lib/hanami/helpers/html_helper/html_fragment.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
HTML Fragment
Instance Method Summary collapse
- #content ⇒ Object private
-
#initialize(&blk) ⇒ Hanami::Helpers::HtmlHelper::HtmlFragment
constructor
private
Initialize a HTML Fragment.
-
#to_s ⇒ String
private
Resolve and return the output.
Constructor Details
#initialize(&blk) ⇒ Hanami::Helpers::HtmlHelper::HtmlFragment
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a HTML Fragment
18 19 20 21 |
# File 'lib/hanami/helpers/html_helper/html_fragment.rb', line 18 def initialize(&blk) @builder = HtmlBuilder.new @blk = blk end |
Instance Method Details
#content ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 39 40 41 42 43 44 |
# File 'lib/hanami/helpers/html_helper/html_fragment.rb', line 36 def content result = @builder.resolve(&@blk) if @builder.nested? @builder.to_s else Utils::Escape.html(result) end end |
#to_s ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Resolve and return the output
31 32 33 |
# File 'lib/hanami/helpers/html_helper/html_fragment.rb', line 31 def to_s content.to_s end |