Class: Stylish::Stylesheet
- Inherits:
-
Tree::SelectorScope
- Object
- Tree::SelectorScope
- Stylish::Stylesheet
- Defined in:
- lib/stylish/core.rb
Instance Attribute Summary
Attributes inherited from Tree::SelectorScope
Instance Method Summary collapse
-
#initialize ⇒ Stylesheet
constructor
Stylesheets are pure aggregate objects; they can contain child nodes, but have no data of their own.
-
#root? ⇒ Boolean
Stylesheets are the roots of selector trees.
-
#to_s(symbols = {}) ⇒ Object
Recursively serialise the tree to a stylesheet.
Methods inherited from Tree::SelectorScope
#<<, #[], #[]=, #comments, #delete, #leaves, #rules, #to_a
Methods included from Formattable
Methods included from Tree::Node
Constructor Details
#initialize ⇒ Stylesheet
Stylesheets are pure aggregate objects; they can contain child nodes, but have no data of their own. Their initializer therefore accepts no arguments.
26 27 28 |
# File 'lib/stylish/core.rb', line 26 def initialize @nodes = [] end |
Instance Method Details
#root? ⇒ Boolean
Stylesheets are the roots of selector trees.
31 32 33 |
# File 'lib/stylish/core.rb', line 31 def root? true end |
#to_s(symbols = {}) ⇒ Object
Recursively serialise the tree to a stylesheet.
36 37 38 39 |
# File 'lib/stylish/core.rb', line 36 def to_s(symbols = {}) return "" if @nodes.empty? @nodes.map {|node| node.to_s(symbols) }.join(self.class.format) end |