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



276
277
278
# File 'lib/philiprehberger/html_builder/builder.rb', line 276

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



281
282
283
284
285
286
287
# File 'lib/philiprehberger/html_builder/builder.rb', line 281

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