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 & Jerry</h1><p class=\"note\"><b>not bold</b></p>"
Class methods
def self.empty -> Bezel::Html
No HTML.
def self.escape(text: String) -> String
text escaped: &, <, >, " and '.
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.
Methods
def source -> String
def to_h -> Hash[Symbol, Object]
The fields as a Hash, by name.
def with(*, source: String = …) -> Bezel::Html
A copy with the fields given replaced.
def +(other: Bezel::Html) -> Bezel::Html
This HTML followed by other.
def empty? -> Bool
Whether there is none.
def to_s -> String
The HTML source.