Class: SyntaxTree::CSS::StyleSheet

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/css/nodes.rb

Overview

This is the top node in the tree if it hasn’t been converted into a CSS stylesheet.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(rules:, location:) ⇒ StyleSheet

Returns a new instance of StyleSheet.



872
873
874
875
# File 'lib/syntax_tree/css/nodes.rb', line 872

def initialize(rules:, location:)
  @rules = rules
  @location = location
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



870
871
872
# File 'lib/syntax_tree/css/nodes.rb', line 870

def location
  @location
end

#rulesObject (readonly)

Returns the value of attribute rules.



870
871
872
# File 'lib/syntax_tree/css/nodes.rb', line 870

def rules
  @rules
end

Instance Method Details

#accept(visitor) ⇒ Object



877
878
879
# File 'lib/syntax_tree/css/nodes.rb', line 877

def accept(visitor)
  visitor.visit_stylesheet(self)
end

#child_nodesObject Also known as: deconstruct



881
882
883
# File 'lib/syntax_tree/css/nodes.rb', line 881

def child_nodes
  rules
end

#deconstruct_keys(keys) ⇒ Object



887
888
889
# File 'lib/syntax_tree/css/nodes.rb', line 887

def deconstruct_keys(keys)
  { rules: rules, location: location }
end