Class: Philiprehberger::HtmlBuilder::RawNode

Inherits:
Object
  • Object
show all
Defined in:
lib/philiprehberger/html_builder/builder.rb

Overview

A node that renders raw HTML without escaping

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ RawNode

Returns a new instance of RawNode.

Parameters:

  • html (String)

    the raw HTML



296
297
298
# File 'lib/philiprehberger/html_builder/builder.rb', line 296

def initialize(html)
  @html = html
end

Instance Method Details

#to_html(indent: nil, indent_size: 2) ⇒ String

Returns the raw HTML.

Returns:

  • (String)

    the raw HTML



301
302
303
304
305
306
307
# File 'lib/philiprehberger/html_builder/builder.rb', line 301

def to_html(indent: nil, indent_size: 2)
  if indent
    "#{' ' * (indent * indent_size)}#{@html}"
  else
    @html
  end
end