Module: Mab::Mixin::HTMLDefiners
- Included in:
- HTML5
- Defined in:
- lib/mab/mixin.rb
Instance Method Summary collapse
- #define_empty_tag(meth, tag) ⇒ Object
- #define_empty_tags(*tags) ⇒ Object
- #define_tag(meth, tag) ⇒ Object
- #define_tags(*tags) ⇒ Object
Instance Method Details
#define_empty_tag(meth, tag) ⇒ Object
216 217 218 219 220 221 222 223 224 |
# File 'lib/mab/mixin.rb', line 216 def define_empty_tag(meth, tag) class_eval " def \#{meth}(*args, &blk)\n tag = mab_tag(:\#{tag})\n tag._has_content = false\n tag._insert(*args, &blk)\n end\n EOF\nend\n" |
#define_empty_tags(*tags) ⇒ Object
226 227 228 229 230 |
# File 'lib/mab/mixin.rb', line 226 def (*) .flatten.each do |tag| define_empty_tag(tag, tag) end end |
#define_tag(meth, tag) ⇒ Object
200 201 202 203 204 205 206 207 208 |
# File 'lib/mab/mixin.rb', line 200 def define_tag(meth, tag) class_eval " def \#{meth}(*args, &blk)\n tag = mab_tag(:\#{tag})\n tag._has_content = true\n tag._insert(*args, &blk)\n end\n EOF\nend\n" |
#define_tags(*tags) ⇒ Object
210 211 212 213 214 |
# File 'lib/mab/mixin.rb', line 210 def (*) .flatten.each do |tag| define_tag(tag, tag) end end |