Class: SyntaxTree::CSS::AtRule
- Defined in:
- lib/syntax_tree/css/nodes.rb
Overview
A rule that starts with an at-keyword and then accepts arbitrary tokens. A common example is an @media rule. www.w3.org/TR/css-syntax-3/#at-rule
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#prelude ⇒ Object
readonly
Returns the value of attribute prelude.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name:, prelude:, block:, location:) ⇒ AtRule
constructor
A new instance of AtRule.
Methods inherited from Node
Constructor Details
#initialize(name:, prelude:, block:, location:) ⇒ AtRule
Returns a new instance of AtRule.
71 72 73 74 75 76 |
# File 'lib/syntax_tree/css/nodes.rb', line 71 def initialize(name:, prelude:, block:, location:) @name = name @prelude = prelude @block = block @location = location end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
69 70 71 |
# File 'lib/syntax_tree/css/nodes.rb', line 69 def block @block end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
69 70 71 |
# File 'lib/syntax_tree/css/nodes.rb', line 69 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
69 70 71 |
# File 'lib/syntax_tree/css/nodes.rb', line 69 def name @name end |
#prelude ⇒ Object (readonly)
Returns the value of attribute prelude.
69 70 71 |
# File 'lib/syntax_tree/css/nodes.rb', line 69 def prelude @prelude end |
Instance Method Details
#accept(visitor) ⇒ Object
78 79 80 |
# File 'lib/syntax_tree/css/nodes.rb', line 78 def accept(visitor) visitor.visit_at_rule(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
82 83 84 |
# File 'lib/syntax_tree/css/nodes.rb', line 82 def child_nodes [*prelude, block].compact end |
#deconstruct_keys(keys) ⇒ Object
88 89 90 |
# File 'lib/syntax_tree/css/nodes.rb', line 88 def deconstruct_keys(keys) { name: name, prelude: prelude, block: block, location: location } end |