Class: SyntaxTree::CSS::WhitespaceToken

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

Overview

A parsed token that contains only whitespace. www.w3.org/TR/css-syntax-3/#typedef-whitespace-token

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(value:, location:) ⇒ WhitespaceToken

Returns a new instance of WhitespaceToken.



949
950
951
952
# File 'lib/syntax_tree/css/nodes.rb', line 949

def initialize(value:, location:)
  @value = value
  @location = Location.from(location)
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



947
948
949
# File 'lib/syntax_tree/css/nodes.rb', line 947

def location
  @location
end

#valueObject (readonly)

Returns the value of attribute value.



947
948
949
# File 'lib/syntax_tree/css/nodes.rb', line 947

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



954
955
956
# File 'lib/syntax_tree/css/nodes.rb', line 954

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

#child_nodesObject Also known as: deconstruct



958
959
960
# File 'lib/syntax_tree/css/nodes.rb', line 958

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



964
965
966
# File 'lib/syntax_tree/css/nodes.rb', line 964

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