Module: DHTML

Includes:
Document
Defined in:
lib/dhtml.rb,
lib/dhtml/version.rb,
lib/dhtml/document.rb

Overview

Since:

  • 0.1.0

Defined Under Namespace

Modules: Document

Constant Summary collapse

VOID_TAGS =

List of tags that do not require a closing tag.

Since:

  • 0.1.0

%i[area audio base br col hr img input link meta param picture source video]
VERSION =

The gem’s semantic version number.

See Also:

Since:

  • 0.1.0

'0.1.3'

Constants included from Document

Document::ESCAPE_HTML, Document::ESCAPE_HTML_PATTERN

Instance Attribute Summary

Attributes included from Document

#tag

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Document

#attributes=, #doctype, #document, #finish, #html_attribute, #html_attributes, #html_escape, #read_html, #reset, #write_html_element, #write_html_tag

Class Method Details

.alias_method(tag, _) ⇒ Symbol

Opal does not support __callee__, so #alias_method is being overridden to provide implementation sufficient for this module.

Parameters:

  • tag (Symbol)

Returns:

  • (Symbol)

    The name of the aliased method.

Since:

  • 0.1.0



31
32
33
34
35
# File 'lib/dhtml.rb', line 31

def self.alias_method(tag, _)
  define_method(tag) do |**attributes, &block|
    write_html_tag(tag: tag, **attributes, &block)
  end
end

Instance Method Details

#void?(tag) ⇒ TrueClass, FalseClass

Parameters:

  • tag (Symbol)

Returns:

  • (TrueClass, FalseClass)

Since:

  • 0.1.0



20
21
22
# File 'lib/dhtml.rb', line 20

def void?(tag)
  VOID_TAGS.include?(tag)
end