Module: Stylish::Tree::Node

Included in:
Leaf, SelectorScope
Defined in:
lib/stylish/tree.rb

Overview

Stylish trees are formed from nodes. The Node module provides a common interface for node objects, whether they be selectors, rules etc.

Instance Method Summary collapse

Instance Method Details

#leaf?Boolean

Normal nodes aren’t leaves. Leaves must override this method in order to be treated appropriately by other objects in the tree.

Returns:

  • (Boolean)


21
22
23
# File 'lib/stylish/tree.rb', line 21

def leaf?
  false
end

#root?Boolean

Normal nodes can’t be the roots of trees. Root nodes act differently when serialising a tree, and hence cannot be added as child nodes.

Returns:

  • (Boolean)


15
16
17
# File 'lib/stylish/tree.rb', line 15

def root?
  false
end