Class: SyntaxTree::CSS::HashToken

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

Overview

A parsed token that contains an identifier that starts with a # sign. www.w3.org/TR/css-syntax-3/#typedef-hash-token

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(value:, type:, location:) ⇒ HashToken

Returns a new instance of HashToken.



552
553
554
555
556
# File 'lib/syntax_tree/css/nodes.rb', line 552

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

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



550
551
552
# File 'lib/syntax_tree/css/nodes.rb', line 550

def location
  @location
end

#typeObject (readonly)

Returns the value of attribute type.



550
551
552
# File 'lib/syntax_tree/css/nodes.rb', line 550

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



550
551
552
# File 'lib/syntax_tree/css/nodes.rb', line 550

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



558
559
560
# File 'lib/syntax_tree/css/nodes.rb', line 558

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

#child_nodesObject Also known as: deconstruct



562
563
564
# File 'lib/syntax_tree/css/nodes.rb', line 562

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



568
569
570
# File 'lib/syntax_tree/css/nodes.rb', line 568

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