Class: SyntaxTree::CSS::NumberToken

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

Overview

A parsed token that contains a numeric value. www.w3.org/TR/css-syntax-3/#typedef-number-token

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

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

Returns a new instance of NumberToken.



603
604
605
606
607
# File 'lib/syntax_tree/css/nodes.rb', line 603

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.



601
602
603
# File 'lib/syntax_tree/css/nodes.rb', line 601

def location
  @location
end

#typeObject (readonly)

Returns the value of attribute type.



601
602
603
# File 'lib/syntax_tree/css/nodes.rb', line 601

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



601
602
603
# File 'lib/syntax_tree/css/nodes.rb', line 601

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



609
610
611
# File 'lib/syntax_tree/css/nodes.rb', line 609

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

#child_nodesObject Also known as: deconstruct



613
614
615
# File 'lib/syntax_tree/css/nodes.rb', line 613

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



619
620
621
# File 'lib/syntax_tree/css/nodes.rb', line 619

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