Class: ShelfTag
- Defined in:
- lib/objective_elements/shelf_tag.rb
Overview
This is a nonexistent HTML tag, which holds content like a double tag but has no opening or closing tag. This allows us to group siblings without adding an extra parent to the markup.
Instance Attribute Summary
Attributes inherited from DoubleTag
Attributes inherited from SingleTag
Instance Method Summary collapse
- #add_parent(parent) ⇒ Object
-
#initialize(content: nil, oneline: false) ⇒ ShelfTag
constructor
A new instance of ShelfTag.
- #to_a ⇒ Object
Methods inherited from DoubleTag
#add_content, #reset_content, #to_s
Methods inherited from SingleTag
#method_missing, #reset_attributes, #respond_to_missing?, #to_s
Constructor Details
#initialize(content: nil, oneline: false) ⇒ ShelfTag
Returns a new instance of ShelfTag.
5 6 7 8 |
# File 'lib/objective_elements/shelf_tag.rb', line 5 def initialize(content: nil, oneline: false) self.oneline = oneline self.content = content end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class SingleTag
Instance Method Details
#add_parent(parent) ⇒ Object
14 15 16 |
# File 'lib/objective_elements/shelf_tag.rb', line 14 def add_parent(parent) parent.add_content content end |
#to_a ⇒ Object
10 11 12 |
# File 'lib/objective_elements/shelf_tag.rb', line 10 def to_a content.map { |c| build_content_line c }.flatten end |