Class: Aurita::GUI::HTML
- Inherits:
-
Object
- Object
- Aurita::GUI::HTML
- Defined in:
- lib/aurita-gui/html.rb
Class Method Summary collapse
- .a(attrib_hash = {}, &block) ⇒ Object
-
.br ⇒ Object
Statically defined as <br /> must not have any attributes.
- .build(&block) ⇒ Object
- .method_missing(meth_name, attrib_hash = {}, &block) ⇒ Object
-
.p(attrib_hash = {}, &block) ⇒ Object
p is defined in Kernel, so we have to redirect it manually (method_missing won’t be triggered for it).
- .render(meth_name, attrib_hash = {}, &block) ⇒ Object
Class Method Details
.a(attrib_hash = {}, &block) ⇒ Object
57 58 59 |
# File 'lib/aurita-gui/html.rb', line 57 def self.a(attrib_hash={}, &block) render(:a, attrib_hash, &block) end |
.br ⇒ Object
Statically defined as <br /> must not have any attributes.
38 39 40 |
# File 'lib/aurita-gui/html.rb', line 38 def self.br Element.new(:tag => :br) end |
.build(&block) ⇒ Object
51 52 53 54 |
# File 'lib/aurita-gui/html.rb', line 51 def self.build(&block) raise ::Exception.new('Missing block for HTML.render') unless block_given? self.class_eval(&block) end |
.method_missing(meth_name, attrib_hash = {}, &block) ⇒ Object
68 69 70 |
# File 'lib/aurita-gui/html.rb', line 68 def self.method_missing(meth_name, attrib_hash={}, &block) render(meth_name, attrib_hash, &block) end |
.p(attrib_hash = {}, &block) ⇒ Object
p is defined in Kernel, so we have to redirect it manually (method_missing won’t be triggered for it)
64 65 66 |
# File 'lib/aurita-gui/html.rb', line 64 def self.p(attrib_hash={}, &block) render(:p, attrib_hash, &block) end |
.render(meth_name, attrib_hash = {}, &block) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/aurita-gui/html.rb', line 42 def self.render(meth_name, attrib_hash={}, &block) raise ::Exception.new('Missing attributes for HTML.' << meth_name.inspect) unless attrib_hash attrib_hash[:tag] = meth_name cont = yield if block_given? # cont = self.class_eval(&block) attrib_hash[:content] = cont Element.new(attrib_hash) end |