Class: SyntaxTree::CSS::StyleRule
- Defined in:
- lib/syntax_tree/css/nodes.rb
Overview
A style rule is a qualified rule that associates a selector list with a list of property declarations and possibly a list of nested rules. www.w3.org/TR/css-syntax-3/#style-rule
Instance Attribute Summary collapse
-
#declarations ⇒ Object
readonly
Returns the value of attribute declarations.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#selectors ⇒ Object
readonly
Returns the value of attribute selectors.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(selectors:, declarations:, location:) ⇒ StyleRule
constructor
A new instance of StyleRule.
Methods inherited from Node
Constructor Details
#initialize(selectors:, declarations:, location:) ⇒ StyleRule
Returns a new instance of StyleRule.
846 847 848 849 850 |
# File 'lib/syntax_tree/css/nodes.rb', line 846 def initialize(selectors:, declarations:, location:) @selectors = selectors @declarations = declarations @location = location end |
Instance Attribute Details
#declarations ⇒ Object (readonly)
Returns the value of attribute declarations.
844 845 846 |
# File 'lib/syntax_tree/css/nodes.rb', line 844 def declarations @declarations end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
844 845 846 |
# File 'lib/syntax_tree/css/nodes.rb', line 844 def location @location end |
#selectors ⇒ Object (readonly)
Returns the value of attribute selectors.
844 845 846 |
# File 'lib/syntax_tree/css/nodes.rb', line 844 def selectors @selectors end |
Instance Method Details
#accept(visitor) ⇒ Object
852 853 854 |
# File 'lib/syntax_tree/css/nodes.rb', line 852 def accept(visitor) visitor.visit_style_rule(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
856 857 858 |
# File 'lib/syntax_tree/css/nodes.rb', line 856 def child_nodes [*selectors, *declarations] end |
#deconstruct_keys(keys) ⇒ Object
862 863 864 |
# File 'lib/syntax_tree/css/nodes.rb', line 862 def deconstruct_keys(keys) { selectors: selectors, declarations: declarations, location: location } end |