Class: Mullet::HTML::Element
- Inherits:
-
Object
- Object
- Mullet::HTML::Element
- Defined in:
- lib/mullet/html/element.rb
Overview
HTML element
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
attributes from template.
-
#has_command ⇒ Object
true if element has any template command.
-
#has_content ⇒ Object
true if element has any child element or text content.
Instance Method Summary collapse
-
#initialize(qualified_name, attributes) ⇒ Element
constructor
Constructor.
- #render_end_tag ⇒ Object
-
#render_start_tag(attributes) ⇒ Object
Renders start tag.
Constructor Details
#initialize(qualified_name, attributes) ⇒ Element
Constructor
21 22 23 24 25 26 |
# File 'lib/mullet/html/element.rb', line 21 def initialize(qualified_name, attributes) @name = qualified_name @attributes = attributes @has_content = false @has_command = false end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
attributes from template
7 8 9 |
# File 'lib/mullet/html/element.rb', line 7 def attributes @attributes end |
#has_command ⇒ Object
true if element has any template command
13 14 15 |
# File 'lib/mullet/html/element.rb', line 13 def has_command @has_command end |
#has_content ⇒ Object
true if element has any child element or text content
10 11 12 |
# File 'lib/mullet/html/element.rb', line 10 def has_content @has_content end |
Instance Method Details
#render_end_tag ⇒ Object
36 37 38 |
# File 'lib/mullet/html/element.rb', line 36 def render_end_tag() return "</#{@name}>" end |
#render_start_tag(attributes) ⇒ Object
Renders start tag
32 33 34 |
# File 'lib/mullet/html/element.rb', line 32 def render_start_tag(attributes) return "<#{@name}#{attributes.render()}>" end |