Class: Swordfish::Node::ListItem
- Defined in:
- lib/swordfish/nodes/list_item.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#nested_list ⇒ Object
Return the nested list, or nil if this list item has no nested lists.
- #to_html ⇒ Object
Methods inherited from Base
#append, #clear_children, #find_nodes_by_type, #inform!, #initialize, #replace, #replace_with, #stylize, #wrap_children
Constructor Details
This class inherits a constructor from Swordfish::Node::Base
Instance Method Details
#nested_list ⇒ Object
Return the nested list, or nil if this list item has no nested lists
12 13 14 |
# File 'lib/swordfish/nodes/list_item.rb', line 12 def nested_list @children.last.is_a?(Swordfish::Node::List) ? @children.last : nil end |
#to_html ⇒ Object
7 8 9 |
# File 'lib/swordfish/nodes/list_item.rb', line 7 def to_html "<li>#{@children.map(&:to_html).join.strip}</li>" end |