Class: DatoDast::HtmlTag
- Inherits:
-
Object
- Object
- DatoDast::HtmlTag
- Defined in:
- lib/dato_dast/html_tag.rb
Constant Summary collapse
- EMPTY =
""
- NEWLINE =
"\n"
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(tag, options = {}) ⇒ HtmlTag
constructor
A new instance of HtmlTag.
- #open ⇒ Object
Constructor Details
#initialize(tag, options = {}) ⇒ HtmlTag
Returns a new instance of HtmlTag.
25 26 27 28 29 30 |
# File 'lib/dato_dast/html_tag.rb', line 25 def initialize(tag, = {}) @tag = tag @css_class = ["css_class"] || "" @meta = ["meta"] || {} @object = ["object"] end |
Class Method Details
.parse(tag, object = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dato_dast/html_tag.rb', line 6 def self.parse(tag, object = nil) case tag when String new(tag) when Hash html_tag = tag["tag"] css_class = tag["css_class"] = tag["meta"] HtmlTag.new(html_tag, { "css_class" => css_class, "meta" => , "object" => object }) when HtmlTag tag when nil HtmlTag.new(nil) else nil end end |