Class: SyntaxTree::CSS::SimpleBlock

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

Overview

A simple block has an associated token (either a <[-token>, <(-token>, or <{-token>) and a value consisting of a list of component values. www.w3.org/TR/css-syntax-3/#simple-block

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(token:, value:, location:) ⇒ SimpleBlock

Returns a new instance of SimpleBlock.



794
795
796
797
798
# File 'lib/syntax_tree/css/nodes.rb', line 794

def initialize(token:, value:, location:)
  @token = token
  @value = value
  @location = location
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



792
793
794
# File 'lib/syntax_tree/css/nodes.rb', line 792

def location
  @location
end

#tokenObject (readonly)

Returns the value of attribute token.



792
793
794
# File 'lib/syntax_tree/css/nodes.rb', line 792

def token
  @token
end

#valueObject (readonly)

Returns the value of attribute value.



792
793
794
# File 'lib/syntax_tree/css/nodes.rb', line 792

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



800
801
802
# File 'lib/syntax_tree/css/nodes.rb', line 800

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

#child_nodesObject Also known as: deconstruct



804
805
806
# File 'lib/syntax_tree/css/nodes.rb', line 804

def child_nodes
  value
end

#deconstruct_keys(keys) ⇒ Object



810
811
812
# File 'lib/syntax_tree/css/nodes.rb', line 810

def deconstruct_keys(keys)
  { token: token, value: value, location: location }
end