Class: Goat::DOMTools::HTMLBuilder::TagBuilder
- Defined in:
- lib/goat/html.rb
Class Method Summary collapse
-
.build(tag, attrs, body) ⇒ Object
TODO: gmail trick of only a single onclick() handler.
Instance Method Summary collapse
- #dispatch ⇒ Object
- #identity ⇒ Object
-
#initialize(tag, attrs, body) ⇒ TagBuilder
constructor
A new instance of TagBuilder.
- #rewrite_attrs ⇒ Object
Constructor Details
#initialize(tag, attrs, body) ⇒ TagBuilder
Returns a new instance of TagBuilder.
195 196 197 198 199 200 201 |
# File 'lib/goat/html.rb', line 195 def initialize(tag, attrs, body) @tag = tag @attrs = attrs @body = body rewrite_attrs end |
Class Method Details
.build(tag, attrs, body) ⇒ Object
TODO: gmail trick of only a single onclick() handler
191 192 193 |
# File 'lib/goat/html.rb', line 191 def self.build(tag, attrs, body) self.new(tag, attrs, body).dispatch end |
Instance Method Details
#dispatch ⇒ Object
221 222 223 224 225 226 227 228 229 |
# File 'lib/goat/html.rb', line 221 def dispatch meth = "#{@tag}_tag".to_sym if self.respond_to?(meth) self.send(meth) else identity end end |
#identity ⇒ Object
217 218 219 |
# File 'lib/goat/html.rb', line 217 def identity [@tag, @attrs, @body] end |