Class: Lotus::Helpers::HtmlHelper::HtmlFragment Private

Inherits:
Object
  • Object
show all
Defined in:
lib/lotus/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

See Also:

Since:

  • 0.2.6

Instance Method Summary collapse

Constructor Details

#initialize(&blk) ⇒ Lotus::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

Parameters:

Since:

  • 0.2.6


16
17
18
19
# File 'lib/lotus/helpers/html_helper/html_fragment.rb', line 16

def initialize(&blk)
  @builder = HtmlBuilder.new
  @blk = blk
end

Instance Method Details

#contentObject

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.

Since:

  • 0.2.6


33
34
35
36
37
38
39
40
41
# File 'lib/lotus/helpers/html_helper/html_fragment.rb', line 33

def content
  result = @builder.resolve(&@blk)

  if @builder.nested?
    @builder.to_s
  else
    "#{ Utils::Escape.html(result) }"
  end
end

#to_sString

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

Returns:

  • (String)

    the output

See Also:

Since:

  • 0.2.6


29
30
31
# File 'lib/lotus/helpers/html_helper/html_fragment.rb', line 29

def to_s
  content.to_s
end