Class: SyntaxTree::CSS::QualifiedRule

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

Overview

Associates a prelude consisting of a list of component values with a block consisting of a simple {} block. www.w3.org/TR/css-syntax-3/#qualified-rule

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(prelude:, block:, location:) ⇒ QualifiedRule

Returns a new instance of QualifiedRule.



743
744
745
746
747
# File 'lib/syntax_tree/css/nodes.rb', line 743

def initialize(prelude:, block:, location:)
  @prelude = prelude
  @block = block
  @location = location
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



741
742
743
# File 'lib/syntax_tree/css/nodes.rb', line 741

def block
  @block
end

#locationObject (readonly)

Returns the value of attribute location.



741
742
743
# File 'lib/syntax_tree/css/nodes.rb', line 741

def location
  @location
end

#preludeObject (readonly)

Returns the value of attribute prelude.



741
742
743
# File 'lib/syntax_tree/css/nodes.rb', line 741

def prelude
  @prelude
end

Instance Method Details

#accept(visitor) ⇒ Object



749
750
751
# File 'lib/syntax_tree/css/nodes.rb', line 749

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

#child_nodesObject Also known as: deconstruct



753
754
755
# File 'lib/syntax_tree/css/nodes.rb', line 753

def child_nodes
  [*prelude, block].compact
end

#deconstruct_keys(keys) ⇒ Object



759
760
761
# File 'lib/syntax_tree/css/nodes.rb', line 759

def deconstruct_keys(keys)
  { prelude: prelude, block: block, location: location }
end