Class: MarkdownUI::Tag
- Inherits:
-
Object
- Object
- MarkdownUI::Tag
- Defined in:
- lib/markdown-ui/tag/tag.rb
Instance Method Summary collapse
-
#initialize(tag, content, klass = nil, data = nil) ⇒ Tag
constructor
A new instance of Tag.
- #render ⇒ Object
Constructor Details
#initialize(tag, content, klass = nil, data = nil) ⇒ Tag
Returns a new instance of Tag.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/markdown-ui/tag/tag.rb', line 3 def initialize(tag, content, klass = nil, data = nil) @mode = OpenStruct.new( :div? => !(tag =~ /div/i).nil?, :label? => !(tag =~ /label/i).nil?, :span? => !(tag =~ /span/i).nil?, :article? => !(tag =~ /article/i).nil?, :section? => !(tag =~ /section/i).nil?, :header? => !(tag =~ /header/i).nil?, :footer? => !(tag =~ /footer/i).nil? ) @tag = tag @content = content @klass = klass @data = data end |
Instance Method Details
#render ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/markdown-ui/tag/tag.rb', line 19 def render if @mode.div? MarkdownUI::StandardTag.new(@content, @klass, nil, @data).render elsif @mode.label? MarkdownUI::LabelTag.new(@content, @klass, nil, @data).render end end |