data Bezel::Html

HTML that is safe to send: what Bezel.html builds, every text in it escaped. (Html.new(source) is Html.raw: the caller vouches.) A value: it is concatenated with +, put in another page with HtmlBuilder#append, and sent with Conn#html or a controller's render.

page = Bezel.html do |h|
  h.h1("Tom & Jerry")
  h.p(class_name: ["note", nil]) { h.text("<b>not bold</b>") }
end
page.to_s   # => "<h1>Tom &amp; Jerry</h1><p class=\"note\">&lt;b&gt;not bold&lt;/b&gt;</p>"

src/html.qz:13

Class methods

def self.empty -> Bezel::Html

No HTML.

src/html.qz:15

def self.escape(text: String) -> String

text escaped: &, <, >, " and '.

src/html.qz:18

def self.raw(text: String) -> Bezel::Html

text as HTML without escaping it: the caller vouches that it is safe (HTML the application wrote, or sanitized). Never pass it what a request sent.

src/html.qz:25

Methods

def source -> String

src/html.qz:13

def to_h -> Hash[Symbol, Object]

The fields as a Hash, by name.

src/html.qz:15

def with(*, source: String = …) -> Bezel::Html

A copy with the fields given replaced.

src/html.qz:15

def +(other: Bezel::Html) -> Bezel::Html

This HTML followed by other.

src/html.qz:28

def empty? -> Bool

Whether there is none.

src/html.qz:31

def to_s -> String

The HTML source.

src/html.qz:34