Class: SyntaxTree::CSS::OpenSquareToken

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

Overview

A parsed token that represents the use of a [. www.w3.org/TR/css-syntax-3/#tokendef-open-square

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(location:) ⇒ OpenSquareToken

Returns a new instance of OpenSquareToken.



687
688
689
# File 'lib/syntax_tree/css/nodes.rb', line 687

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

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



685
686
687
# File 'lib/syntax_tree/css/nodes.rb', line 685

def location
  @location
end

Instance Method Details

#accept(visitor) ⇒ Object



691
692
693
# File 'lib/syntax_tree/css/nodes.rb', line 691

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

#child_nodesObject Also known as: deconstruct



695
696
697
# File 'lib/syntax_tree/css/nodes.rb', line 695

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



701
702
703
# File 'lib/syntax_tree/css/nodes.rb', line 701

def deconstruct_keys(keys)
  { location: location }
end

#valueObject

Here for convenience for comparing between block types.



706
707
708
# File 'lib/syntax_tree/css/nodes.rb', line 706

def value
  "["
end